home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume12 / acm / part01 next >
Encoding:
Internet Message Format  |  1991-03-01  |  65.6 KB

  1. Path: uunet!spool.mu.edu!sol.ctr.columbia.edu!lll-winken!sun-barr!newstop!texsun!male!jethro!exodus!mipsdal.mips.com
  2. From: riley@mipsdal.mips.com (Riley Rainey)
  3. Newsgroups: comp.sources.x
  4. Subject: v12i006: acm - X aerial combat simulation, Part01/09
  5. Message-ID: <csx-12i006:acm@uunet.UU.NET>
  6. Date: 2 Mar 91 08:31:58 GMT
  7. Sender: news@exodus.Eng.Sun.COM
  8. Lines: 2462
  9. Approved: argv@sun.com
  10. Posted: Sat Mar  2 02:31:58 1991
  11.  
  12. Submitted-by: riley@mipsdal.mips.com (Riley Rainey)
  13. Posting-number: Volume 12, Issue 6
  14. Archive-name: acm/part01
  15.  
  16. Acm is a multiplayer jet aerial combat simulation for X and Unix.  It is
  17. written to run on a variety of platforms.
  18.  
  19. Players can fly F-16's and Mig-23's against one another, engaging in aerial
  20. combat with heat seeking missiles and cannons.
  21.  
  22. This revision contains many enhancements to the 1.1 code that was posted
  23. to comp.sources.x last Fall.  An eleven page user's guide in PostScript format
  24. has been included, as well.
  25.  
  26. Riley Rainey
  27. February 14, 1991
  28.  
  29. --->  CUT HERE   CUT HERE   CUT HERE  <---
  30. #! /bin/sh
  31. # This is a shell archive.  Remove anything before this line, then unpack
  32. # it by saving it into a file and typing "sh file".  To overwrite existing
  33. # files, type "sh file -c".  You can also feed this as standard input via
  34. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  35. # will see the following message at the end:
  36. #        "End of archive 1 (of 9)."
  37. # Contents:  acm acm/Imakefile acm/V acm/V/Imakefile acm/V/lib
  38. #   acm/V/lib/Imakefile acm/V/lib/VAllocColor.c acm/V/lib/VCloseVp.c
  39. #   acm/V/lib/VCopyPoly.c acm/V/lib/VCrPoints.c acm/V/lib/VCrPoly.c
  40. #   acm/V/lib/VCrossProd.c acm/V/lib/VDispObjects.c
  41. #   acm/V/lib/VDotProd.c acm/V/lib/VDrawPoly.c acm/V/lib/VDrawString.c
  42. #   acm/V/lib/VExpBuffer.c acm/V/lib/VEyeToScr.c acm/V/lib/VFillPoly.c
  43. #   acm/V/lib/VGetPlanes.c acm/V/lib/VIdentMat.c acm/V/lib/VMatDet.c
  44. #   acm/V/lib/VMatInvert.c acm/V/lib/VMatMult.c acm/V/lib/VPrintPoly.c
  45. #   acm/V/lib/VReadObject.c acm/V/lib/VResizeVp.c acm/V/lib/VRotate.c
  46. #   acm/V/lib/VTrans.c acm/V/lib/VTransPoly.c acm/V/lib/VWorldToScr.c
  47. #   acm/V/lib/VWriteObject.c acm/V/lib/Vmalloc.c acm/V/lib/strdup.c
  48. #   acm/V/test acm/V/test/Imakefile acm/V/test/fixf16.c
  49. #   acm/V/test/fixmig.c acm/acm.def acm/fsim acm/fsim/V2tgif.c
  50. #   acm/fsim/aim-9 acm/fsim/bullet acm/fsim/damage.h
  51. #   acm/fsim/droneCalc.c acm/fsim/flaps0.xbm acm/fsim/flaps2.xbm
  52. #   acm/fsim/flaps3.xbm acm/fsim/getStick.c acm/fsim/header
  53. #   acm/fsim/manifest.h acm/fsim/mtn acm/fsim/patchlevel.h
  54. #   acm/fsim/placeCraft.c acm/fsim/rwy2 acm/fsim/scale.h
  55. #   acm/fsim/tower acm/fsim/transpose.c acm/fsim/update.c
  56. #   acm/fsim/weapon.c acm/install-objects
  57. # Wrapped by riley@mipsdal on Thu Feb 14 10:09:15 1991
  58. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  59. if test ! -d 'acm' ; then
  60.     echo shar: Creating directory \"'acm'\"
  61.     mkdir 'acm'
  62. fi
  63. if test -f 'acm/Imakefile' -a "${1}" != "-c" ; then 
  64.   echo shar: Will not clobber existing file \"'acm/Imakefile'\"
  65. else
  66. echo shar: Extracting \"'acm/Imakefile'\" \(361 characters\)
  67. sed "s/^X//" >'acm/Imakefile' <<'END_OF_FILE'
  68. X/*
  69. X *  To build acm:
  70. X *
  71. X *    If you have imake:
  72. X *
  73. X *        % imake Makefile
  74. X *        % make Makefiles
  75. X *        % make all
  76. X *
  77. X *    If you don't, first tailor the Makefiles to your system, then:
  78. X *
  79. X *        % make all
  80. X */
  81. X
  82. X#include "./acm.def"
  83. X
  84. X#define IHaveSubdirs
  85. X#define PassCDebugFlags CDEBUFLAGS='$(CDEBUGFLAGS)'
  86. X
  87. XSUBDIRS=    V fsim
  88. X
  89. XMakeSubdirs($(SUBDIRS))
  90. XDependSubdirs($(SUBDIRS))
  91. END_OF_FILE
  92. if test 361 -ne `wc -c <'acm/Imakefile'`; then
  93.     echo shar: \"'acm/Imakefile'\" unpacked with wrong size!
  94. fi
  95. # end of 'acm/Imakefile'
  96. fi
  97. if test ! -d 'acm/V' ; then
  98.     echo shar: Creating directory \"'acm/V'\"
  99.     mkdir 'acm/V'
  100. fi
  101. if test -f 'acm/V/Imakefile' -a "${1}" != "-c" ; then 
  102.   echo shar: Will not clobber existing file \"'acm/V/Imakefile'\"
  103. else
  104. echo shar: Extracting \"'acm/V/Imakefile'\" \(196 characters\)
  105. sed "s/^X//" >'acm/V/Imakefile' <<'END_OF_FILE'
  106. X#include "../acm.def"
  107. X
  108. X#define IHaveSubdirs
  109. X#define PassCDebugFlags CDEBUFLAGS='$(CDEBUGFLAGS)'
  110. X
  111. XSUBDIRS=    lib        /* don't build test by default */
  112. X
  113. XMakeSubdirs($(SUBDIRS))
  114. XDependSubdirs($(SUBDIRS))
  115. END_OF_FILE
  116. if test 196 -ne `wc -c <'acm/V/Imakefile'`; then
  117.     echo shar: \"'acm/V/Imakefile'\" unpacked with wrong size!
  118. fi
  119. # end of 'acm/V/Imakefile'
  120. fi
  121. if test ! -d 'acm/V/lib' ; then
  122.     echo shar: Creating directory \"'acm/V/lib'\"
  123.     mkdir 'acm/V/lib'
  124. fi
  125. if test -f 'acm/V/lib/Imakefile' -a "${1}" != "-c" ; then 
  126.   echo shar: Will not clobber existing file \"'acm/V/lib/Imakefile'\"
  127. else
  128. echo shar: Extracting \"'acm/V/lib/Imakefile'\" \(1148 characters\)
  129. sed "s/^X//" >'acm/V/lib/Imakefile' <<'END_OF_FILE'
  130. X#include "../../acm.def"
  131. X
  132. XSRCS    = \
  133. X      VOpenVp.c \
  134. X      VResizeVp.c \
  135. X      VCloseVp.c \
  136. X      VGetEyeSpace.c \
  137. X      VGetPlanes.c \
  138. X      VReadObject.c \
  139. X      VWriteObject.c \
  140. X      VAllocColor.c \
  141. X      VBindColors.c \
  142. X      VExpBuffer.c \
  143. X      VCrPoly.c \
  144. X      VCrPoints.c \
  145. X      VCopyPoly.c \
  146. X      VDrawPoly.c \
  147. X      VFillPoly.c \
  148. X      VDrawString.c \
  149. X      VClipPoly.c \
  150. X      VDotProd.c \
  151. X      VCrossProd.c \
  152. X      VRotate.c \
  153. X      VTransPoly.c \
  154. X      VWorldToScr.c \
  155. X      VEyeToScr.c \
  156. X      VTrans.c \
  157. X      VIdentMat.c \
  158. X      VMatMult.c \
  159. X      VMatDet.c \
  160. X      VMatInvert.c \
  161. X      VPrintPoly.c \
  162. X      Vmalloc.c \
  163. X      strdup.c
  164. X
  165. XOBJS    = \
  166. X      VOpenVp.o \
  167. X      VResizeVp.o \
  168. X      VCloseVp.o \
  169. X      VGetEyeSpace.o \
  170. X      VGetPlanes.o \
  171. X      VReadObject.o \
  172. X      VWriteObject.o \
  173. X      VAllocColor.o \
  174. X      VBindColors.o \
  175. X      VExpBuffer.o \
  176. X      VCrPoly.o \
  177. X      VCrPoints.o \
  178. X      VCopyPoly.o \
  179. X      VDrawPoly.o \
  180. X      VFillPoly.o \
  181. X      VDrawString.o \
  182. X      VClipPoly.o \
  183. X      VDotProd.o \
  184. X      VCrossProd.o \
  185. X      VRotate.o \
  186. X      VTransPoly.o \
  187. X      VWorldToScr.o \
  188. X      VEyeToScr.o \
  189. X      VTrans.o \
  190. X      VIdentMat.o \
  191. X      VMatMult.o \
  192. X      VMatDet.o \
  193. X      VMatInvert.o \
  194. X      VPrintPoly.o \
  195. X      Vmalloc.o \
  196. X      strdup.o
  197. X
  198. XNormalLibraryTarget(V,$(OBJS))
  199. XDependTarget()
  200. END_OF_FILE
  201. if test 1148 -ne `wc -c <'acm/V/lib/Imakefile'`; then
  202.     echo shar: \"'acm/V/lib/Imakefile'\" unpacked with wrong size!
  203. fi
  204. # end of 'acm/V/lib/Imakefile'
  205. fi
  206. if test -f 'acm/V/lib/VAllocColor.c' -a "${1}" != "-c" ; then 
  207.   echo shar: Will not clobber existing file \"'acm/V/lib/VAllocColor.c'\"
  208. else
  209. echo shar: Extracting \"'acm/V/lib/VAllocColor.c'\" \(577 characters\)
  210. sed "s/^X//" >'acm/V/lib/VAllocColor.c' <<'END_OF_FILE'
  211. X#include "Vlib.h"
  212. X#include <string.h>
  213. X
  214. XVColor *VAllocColor (name)
  215. Xchar *name; {
  216. X
  217. X    VColor    *p=VColorList, *prev=0, **q;
  218. X
  219. X/*
  220. X *  Search for this color among those already allocated.
  221. X */
  222. X
  223. X    while (p != (VColor *) 0) {
  224. X        if (strcmp(p->color_name, name) == 0) {
  225. X            return p;
  226. X        }
  227. X        prev = p;
  228. X        p = p->next;
  229. X    }
  230. X
  231. X/*
  232. X *  The color was not in the list; allocate a new list element.
  233. X */
  234. X
  235. X    if (prev == (VColor *)0)
  236. X        q = &VColorList;
  237. X    else
  238. X        q = &(prev->next);
  239. X
  240. X    *q = (VColor *) Vmalloc (sizeof(VColor));
  241. X    (*q)->color_name = strdup (name);
  242. X    (*q)->index = -1;
  243. X    (*q)->next = 0;
  244. X
  245. X    return *q;
  246. X}
  247. END_OF_FILE
  248. if test 577 -ne `wc -c <'acm/V/lib/VAllocColor.c'`; then
  249.     echo shar: \"'acm/V/lib/VAllocColor.c'\" unpacked with wrong size!
  250. fi
  251. # end of 'acm/V/lib/VAllocColor.c'
  252. fi
  253. if test -f 'acm/V/lib/VCloseVp.c' -a "${1}" != "-c" ; then 
  254.   echo shar: Will not clobber existing file \"'acm/V/lib/VCloseVp.c'\"
  255. else
  256. echo shar: Extracting \"'acm/V/lib/VCloseVp.c'\" \(113 characters\)
  257. sed "s/^X//" >'acm/V/lib/VCloseVp.c' <<'END_OF_FILE'
  258. X#include "Vlib.h"
  259. X
  260. Xvoid VCloseViewport (v)
  261. XViewport *v; {
  262. X
  263. X    VDestroyPolygon (v->clipPoly);
  264. X    free ((char *) v);
  265. X}
  266. END_OF_FILE
  267. if test 113 -ne `wc -c <'acm/V/lib/VCloseVp.c'`; then
  268.     echo shar: \"'acm/V/lib/VCloseVp.c'\" unpacked with wrong size!
  269. fi
  270. # end of 'acm/V/lib/VCloseVp.c'
  271. fi
  272. if test -f 'acm/V/lib/VCopyPoly.c' -a "${1}" != "-c" ; then 
  273.   echo shar: Will not clobber existing file \"'acm/V/lib/VCopyPoly.c'\"
  274. else
  275. echo shar: Extracting \"'acm/V/lib/VCopyPoly.c'\" \(138 characters\)
  276. sed "s/^X//" >'acm/V/lib/VCopyPoly.c' <<'END_OF_FILE'
  277. X#include "Vlib.h"
  278. X
  279. XVPolygon *VCopyPolygon (poly)
  280. XVPolygon *poly; {
  281. X
  282. X    return VCreatePolygon (poly->numVtces, poly->vertex, poly->color);
  283. X}
  284. END_OF_FILE
  285. if test 138 -ne `wc -c <'acm/V/lib/VCopyPoly.c'`; then
  286.     echo shar: \"'acm/V/lib/VCopyPoly.c'\" unpacked with wrong size!
  287. fi
  288. # end of 'acm/V/lib/VCopyPoly.c'
  289. fi
  290. if test -f 'acm/V/lib/VCrPoints.c' -a "${1}" != "-c" ; then 
  291.   echo shar: Will not clobber existing file \"'acm/V/lib/VCrPoints.c'\"
  292. else
  293. echo shar: Extracting \"'acm/V/lib/VCrPoints.c'\" \(121 characters\)
  294. sed "s/^X//" >'acm/V/lib/VCrPoints.c' <<'END_OF_FILE'
  295. X#include "Vlib.h"
  296. X
  297. XVPoint *VCreatePoints (numPts)
  298. Xint    numPts; {
  299. X
  300. X    return (VPoint *) Vmalloc (sizeof(VPoint) * numPts);
  301. X}
  302. END_OF_FILE
  303. if test 121 -ne `wc -c <'acm/V/lib/VCrPoints.c'`; then
  304.     echo shar: \"'acm/V/lib/VCrPoints.c'\" unpacked with wrong size!
  305. fi
  306. # end of 'acm/V/lib/VCrPoints.c'
  307. fi
  308. if test -f 'acm/V/lib/VCrPoly.c' -a "${1}" != "-c" ; then 
  309.   echo shar: Will not clobber existing file \"'acm/V/lib/VCrPoly.c'\"
  310. else
  311. echo shar: Extracting \"'acm/V/lib/VCrPoly.c'\" \(369 characters\)
  312. sed "s/^X//" >'acm/V/lib/VCrPoly.c' <<'END_OF_FILE'
  313. X#include "Vlib.h"
  314. X
  315. XVPolygon *VCreatePolygon (numVtces, vert, color)
  316. Xint    numVtces;
  317. XVPoint    *vert;
  318. XVColor    *color; {
  319. X
  320. X    VPolygon *p;
  321. X
  322. X    p = (VPolygon *) Vmalloc (sizeof (VPolygon));
  323. X
  324. X    p->numVtces = numVtces;
  325. X    p->vertex = (VPoint *) Vmalloc (sizeof (VPoint) * numVtces);
  326. X    memcpy ((char *) p->vertex, (char *) vert, sizeof(VPoint) * numVtces);
  327. X    p->color = color;
  328. X
  329. X    return p;
  330. X}
  331. END_OF_FILE
  332. if test 369 -ne `wc -c <'acm/V/lib/VCrPoly.c'`; then
  333.     echo shar: \"'acm/V/lib/VCrPoly.c'\" unpacked with wrong size!
  334. fi
  335. # end of 'acm/V/lib/VCrPoly.c'
  336. fi
  337. if test -f 'acm/V/lib/VCrossProd.c' -a "${1}" != "-c" ; then 
  338.   echo shar: Will not clobber existing file \"'acm/V/lib/VCrossProd.c'\"
  339. else
  340. echo shar: Extracting \"'acm/V/lib/VCrossProd.c'\" \(174 characters\)
  341. sed "s/^X//" >'acm/V/lib/VCrossProd.c' <<'END_OF_FILE'
  342. X#include "Vlib.h"
  343. X
  344. Xvoid VCrossProd (a, b, r)
  345. XVPoint    *a, *b, *r; {
  346. X
  347. X    r->x = a->y * b->z - a->z * b->y;
  348. X    r->y = a->z * b->x - a->x * b->z;
  349. X    r->z = a->x * b->y - a->y * b->x;
  350. X}
  351. END_OF_FILE
  352. if test 174 -ne `wc -c <'acm/V/lib/VCrossProd.c'`; then
  353.     echo shar: \"'acm/V/lib/VCrossProd.c'\" unpacked with wrong size!
  354. fi
  355. # end of 'acm/V/lib/VCrossProd.c'
  356. fi
  357. if test -f 'acm/V/lib/VDispObjects.c' -a "${1}" != "-c" ; then 
  358.   echo shar: Will not clobber existing file \"'acm/V/lib/VDispObjects.c'\"
  359. else
  360. echo shar: Extracting \"'acm/V/lib/VDispObjects.c'\" \(492 characters\)
  361. sed "s/^X//" >'acm/V/lib/VDispObjects.c' <<'END_OF_FILE'
  362. X#include "Vlib.h"
  363. X
  364. Xvoid VDisplayObjects() {
  365. X
  366. X    Point3     TmpPt;
  367. X    int    I, J;
  368. X    XPoint    xpt[MaxPts];
  369. X
  370. X    for (I=0; I<NumPolys; ++I) {
  371. X
  372. X        for (J=0; J<Polygons[I].PolyVtces; ++J) {
  373. X            Transform(&Points[Vertices[Polygons[I].Start + J]], &EyeSpace, &TmpPt);
  374. X            MakeDisplayable(&TmpPt);
  375. X            xpt[J].x = (int) TmpPt.X;
  376. X            xpt[J].y = (int) TmpPt.Y;
  377. X        }
  378. X/*        xpt[J] = xpt[0];
  379. X        XDrawLines (dpy, win, gc, &xpt, J+1, CoordModeOrigin); */
  380. X        XFillPolygon (dpy, win, curGC, &xpt, J, Nonconvex, CoordModeOrigin);
  381. X    }
  382. X
  383. X}
  384. END_OF_FILE
  385. if test 492 -ne `wc -c <'acm/V/lib/VDispObjects.c'`; then
  386.     echo shar: \"'acm/V/lib/VDispObjects.c'\" unpacked with wrong size!
  387. fi
  388. # end of 'acm/V/lib/VDispObjects.c'
  389. fi
  390. if test -f 'acm/V/lib/VDotProd.c' -a "${1}" != "-c" ; then 
  391.   echo shar: Will not clobber existing file \"'acm/V/lib/VDotProd.c'\"
  392. else
  393. echo shar: Extracting \"'acm/V/lib/VDotProd.c'\" \(111 characters\)
  394. sed "s/^X//" >'acm/V/lib/VDotProd.c' <<'END_OF_FILE'
  395. X#include "Vlib.h"
  396. X
  397. Xdouble VDotProd (a, b)
  398. XVPoint    *a, *b; {
  399. X
  400. X    return a->x * b->x + a->y * b->y + a->z * b->z;
  401. X}
  402. END_OF_FILE
  403. if test 111 -ne `wc -c <'acm/V/lib/VDotProd.c'`; then
  404.     echo shar: \"'acm/V/lib/VDotProd.c'\" unpacked with wrong size!
  405. fi
  406. # end of 'acm/V/lib/VDotProd.c'
  407. fi
  408. if test -f 'acm/V/lib/VDrawPoly.c' -a "${1}" != "-c" ; then 
  409.   echo shar: Will not clobber existing file \"'acm/V/lib/VDrawPoly.c'\"
  410. else
  411. echo shar: Extracting \"'acm/V/lib/VDrawPoly.c'\" \(763 characters\)
  412. sed "s/^X//" >'acm/V/lib/VDrawPoly.c' <<'END_OF_FILE'
  413. X#include "Vlib.h"
  414. X
  415. Xvoid VDrawPolygon(v, win, gc, poly)
  416. XViewport *v;
  417. XWindow     win;
  418. XGC     gc;
  419. XVPolygon *poly; {
  420. X
  421. X    VPoint     TmpPt, *p;
  422. X    XPoint    xpt[VmaxVP];
  423. X    int    i;
  424. X    Drawable d;
  425. X
  426. X    d = (v->flags & VPPixmap) ? (Drawable) v->monoPixmap : (Drawable) win;
  427. X
  428. X    if (poly == (VPolygon *) NULL)
  429. X        return;
  430. X
  431. X    for ((i=0, p=poly->vertex); i<poly->numVtces; (++i, ++p)) {
  432. X        if (v->flags & VPPerspective) {
  433. X        TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z;
  434. X        TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z;
  435. X        }
  436. X        else {
  437. X        TmpPt.x = v->Middl.x + v->Scale.x * p->x;
  438. X        TmpPt.y = v->Middl.y - v->Scale.y * p->y;
  439. X        }
  440. X        xpt[i].x = TmpPt.x + 0.5;
  441. X        xpt[i].y = TmpPt.y + 0.5;
  442. X    }
  443. X
  444. X    if (i > 0) {
  445. X        xpt[i] = xpt[0];
  446. X        XDrawLines (v->dpy, d, gc, xpt, i+1, CoordModeOrigin);
  447. X    }
  448. X
  449. X}
  450. END_OF_FILE
  451. if test 763 -ne `wc -c <'acm/V/lib/VDrawPoly.c'`; then
  452.     echo shar: \"'acm/V/lib/VDrawPoly.c'\" unpacked with wrong size!
  453. fi
  454. # end of 'acm/V/lib/VDrawPoly.c'
  455. fi
  456. if test -f 'acm/V/lib/VDrawString.c' -a "${1}" != "-c" ; then 
  457.   echo shar: Will not clobber existing file \"'acm/V/lib/VDrawString.c'\"
  458. else
  459. echo shar: Extracting \"'acm/V/lib/VDrawString.c'\" \(499 characters\)
  460. sed "s/^X//" >'acm/V/lib/VDrawString.c' <<'END_OF_FILE'
  461. X#include "Vlib.h"
  462. X
  463. Xvoid VDrawString(v, win, gc, p, str, len)
  464. XViewport *v;
  465. XWindow     win;
  466. XGC     gc;
  467. XVPoint     *p;
  468. Xchar     *str;
  469. Xint     len; {
  470. X
  471. X    VPoint     TmpPt;
  472. X    register int    x, y;
  473. X
  474. X    if (v->flags & VPPerspective) {
  475. X        TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z;
  476. X        TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z;
  477. X    }
  478. X    else {
  479. X        TmpPt.x = v->Middl.x + v->Scale.x * p->x;
  480. X        TmpPt.y = v->Middl.y - v->Scale.y * p->y;
  481. X    }
  482. X
  483. X    x = TmpPt.x + 0.5;
  484. X    y = TmpPt.y + 0.5;
  485. X
  486. X    XDrawString (v->dpy, win, gc, x, y, str, len);
  487. X
  488. X}
  489. END_OF_FILE
  490. if test 499 -ne `wc -c <'acm/V/lib/VDrawString.c'`; then
  491.     echo shar: \"'acm/V/lib/VDrawString.c'\" unpacked with wrong size!
  492. fi
  493. # end of 'acm/V/lib/VDrawString.c'
  494. fi
  495. if test -f 'acm/V/lib/VExpBuffer.c' -a "${1}" != "-c" ; then 
  496.   echo shar: Will not clobber existing file \"'acm/V/lib/VExpBuffer.c'\"
  497. else
  498. echo shar: Extracting \"'acm/V/lib/VExpBuffer.c'\" \(1455 characters\)
  499. sed "s/^X//" >'acm/V/lib/VExpBuffer.c' <<'END_OF_FILE'
  500. X#include "Vlib.h"
  501. X
  502. Xvoid VExposeBuffer (v, gc)
  503. XViewport *v;
  504. XGC    gc; {
  505. X
  506. X/*
  507. X * this is one area where more-than-one window per display gets hairy
  508. X * -- this call really exposes the drawings buffered in all windows
  509. X * associated with a given display.  the calling sequence needs to be
  510. X * changed to reflect this.
  511. X */
  512. X
  513. X    if (v->flags & VPMono) {
  514. X    XCopyArea (v->dpy, v->monoPixmap, v->win, gc,
  515. X        0, 0, v->width, v->height, 0, 0);
  516. X    XSetForeground (v->dpy, gc, WhitePixel(v->dpy, v->screen));
  517. X    XFillRectangle (v->dpy, v->monoPixmap, gc, 0, 0, v->width, v->height);
  518. X    XSetForeground (v->dpy, gc, BlackPixel(v->dpy, v->screen));
  519. X    return;
  520. X    }
  521. X    else if (v->flags & VPPixmap) {
  522. X    XCopyArea (v->dpy, v->monoPixmap, v->win, gc,
  523. X        0, 0, v->width, v->height, 0, 0);
  524. X    return;
  525. X    }
  526. X
  527. X    if (v->set == 0) {
  528. X    v->set = 1;
  529. X    XStoreColors (v->dpy, v->cmap, v->aColor, v->colors*v->colors);
  530. X    v->pixel = &(v->bPixel[0]);
  531. X    XSetPlaneMask (v->dpy, gc, v->bMask);
  532. X    v->mask = v->bMask;
  533. X    /*
  534. X    for ((p=VColorList, q = &(v->bPixel[1])); p != (VColor *) 0; ++q) {
  535. X        p->xcolor.pixel = *q;
  536. X        p = p->next;
  537. X    }
  538. X    */
  539. X    }
  540. X    else {
  541. X    v->set = 0;
  542. X    XStoreColors (v->dpy, v->cmap, v->bColor, v->colors*v->colors);
  543. X    v->pixel = &(v->aPixel[0]);
  544. X    XSetPlaneMask (v->dpy, gc, v->aMask);
  545. X    v->mask = v->aMask;
  546. X    /*
  547. X    for ((p=VColorList, q = &(v->aPixel[1])); p != (VColor *) 0; ++q) {
  548. X        p->xcolor.pixel = *q;
  549. X        p = p->next;
  550. X    }
  551. X    */
  552. X    }
  553. X
  554. X/*    XSync (v->dpy, False); */
  555. X    XFlush (v->dpy);
  556. X}
  557. END_OF_FILE
  558. if test 1455 -ne `wc -c <'acm/V/lib/VExpBuffer.c'`; then
  559.     echo shar: \"'acm/V/lib/VExpBuffer.c'\" unpacked with wrong size!
  560. fi
  561. # end of 'acm/V/lib/VExpBuffer.c'
  562. fi
  563. if test -f 'acm/V/lib/VEyeToScr.c' -a "${1}" != "-c" ; then 
  564.   echo shar: Will not clobber existing file \"'acm/V/lib/VEyeToScr.c'\"
  565. else
  566. echo shar: Extracting \"'acm/V/lib/VEyeToScr.c'\" \(551 characters\)
  567. sed "s/^X//" >'acm/V/lib/VEyeToScr.c' <<'END_OF_FILE'
  568. X#include "Vlib.h"
  569. X
  570. X/*
  571. X *  Transform a 3-D point in the eye space system into viewable
  572. X *  coordinates.  The function returns 1 if the x,y information is
  573. X *  displayable (probably displayable, that is).
  574. X *
  575. X *  VWorldToEye can be used to convert world coordinates to x,y values.
  576. X */
  577. X
  578. Xint VEyeToScreen (v, p, x, y)
  579. XViewport    *v;
  580. XVPoint        *p;
  581. Xint        *x, *y; {
  582. X
  583. X    register int valid;
  584. X
  585. X    if (p->z > 0.0) {
  586. X        *x = v->Middl.x + v->Scale.x * p->x / p->z + 0.5;
  587. X        *y = v->Middl.y - v->Scale.y * p->y / p->z + 0.5;
  588. X        valid = 1;
  589. X    }
  590. X    else
  591. X        valid = 0;
  592. X
  593. X    return valid;
  594. X}
  595. END_OF_FILE
  596. if test 551 -ne `wc -c <'acm/V/lib/VEyeToScr.c'`; then
  597.     echo shar: \"'acm/V/lib/VEyeToScr.c'\" unpacked with wrong size!
  598. fi
  599. # end of 'acm/V/lib/VEyeToScr.c'
  600. fi
  601. if test -f 'acm/V/lib/VFillPoly.c' -a "${1}" != "-c" ; then 
  602.   echo shar: Will not clobber existing file \"'acm/V/lib/VFillPoly.c'\"
  603. else
  604. echo shar: Extracting \"'acm/V/lib/VFillPoly.c'\" \(1215 characters\)
  605. sed "s/^X//" >'acm/V/lib/VFillPoly.c' <<'END_OF_FILE'
  606. X#include "Vlib.h"
  607. X
  608. X#define COLLAPSEUNUSEDPOINTS
  609. X
  610. Xvoid VFillPolygon(v, win, gc, poly)
  611. XViewport *v;
  612. XWindow     win;
  613. XGC     gc;
  614. XVPolygon *poly; {
  615. X
  616. X    VPoint     TmpPt, *p;
  617. X    XPoint    xpt[VmaxVP], *lastpt;
  618. X    int    i, k;
  619. X    Drawable d;
  620. X
  621. X    d = (v->flags & VPPixmap) ? (Drawable) v->monoPixmap : (Drawable) win;
  622. X
  623. X    if (poly == (VPolygon *) NULL)
  624. X        return;
  625. X
  626. X    k = 0;
  627. X    lastpt = &xpt[0];
  628. X    for ((i=0, p=poly->vertex); i<poly->numVtces; (++i, ++p)) {
  629. X        if (v->flags & VPPerspective) {
  630. X        TmpPt.x = v->Middl.x + v->Scale.x * p->x / p->z;
  631. X        TmpPt.y = v->Middl.y - v->Scale.y * p->y / p->z;
  632. X        }
  633. X        else {
  634. X        TmpPt.x = v->Middl.x + v->Scale.x * p->x;
  635. X        TmpPt.y = v->Middl.y - v->Scale.y * p->y;
  636. X        }
  637. X
  638. X#ifdef COLLAPSEUNUSEDPOINTS
  639. X        xpt[k].x = TmpPt.x + 0.5;
  640. X        xpt[k].y = TmpPt.y + 0.5;
  641. X
  642. X        if (k == 0 || !(xpt[k].x == lastpt->x && xpt[k].y == lastpt->y))
  643. X        lastpt = &xpt[k++];
  644. X
  645. X#else
  646. X        xpt[k].x = TmpPt.x + 0.5;
  647. X        xpt[k].y = TmpPt.y + 0.5;
  648. X        ++k;
  649. X#endif
  650. X
  651. X    }
  652. X
  653. X    if (k > 0) {
  654. X#ifdef COLLAPSEUNUSEDPOINTS
  655. X        if (k == 1)
  656. X            XDrawPoint (v->dpy, d, gc, xpt[0].x, xpt[0].y);
  657. X        else if (k == 2)
  658. X            XDrawLines (v->dpy, d, gc, xpt, 2, CoordModeOrigin);
  659. X        else
  660. X#endif
  661. X        XFillPolygon (v->dpy, d, gc, xpt, k, Nonconvex, CoordModeOrigin);
  662. X    }
  663. X
  664. X}
  665. END_OF_FILE
  666. if test 1215 -ne `wc -c <'acm/V/lib/VFillPoly.c'`; then
  667.     echo shar: \"'acm/V/lib/VFillPoly.c'\" unpacked with wrong size!
  668. fi
  669. # end of 'acm/V/lib/VFillPoly.c'
  670. fi
  671. if test -f 'acm/V/lib/VGetPlanes.c' -a "${1}" != "-c" ; then 
  672.   echo shar: Will not clobber existing file \"'acm/V/lib/VGetPlanes.c'\"
  673. else
  674. echo shar: Extracting \"'acm/V/lib/VGetPlanes.c'\" \(537 characters\)
  675. sed "s/^X//" >'acm/V/lib/VGetPlanes.c' <<'END_OF_FILE'
  676. X#include "Vlib.h"
  677. X
  678. XVPolygon *VGetPlanes (poly)
  679. XVPolygon *poly; {
  680. X
  681. X    VPoint    tmp[64], *p;
  682. X    int    i, lasti;
  683. X
  684. X    lasti = poly->numVtces - 1;
  685. X    p = poly->vertex;
  686. X
  687. X    for (i=0; i<poly->numVtces; ++i) {
  688. X        tmp[i].x = p->y * poly->vertex[lasti].z - p->z *
  689. X        poly->vertex[lasti].y;
  690. X        tmp[i].y = p->z * poly->vertex[lasti].x - p->x *
  691. X        poly->vertex[lasti].z;
  692. X        tmp[i].z = p->x * poly->vertex[lasti].y - p->y *
  693. X        poly->vertex[lasti].x;
  694. X        lasti = i;
  695. X        p++;
  696. X    }
  697. X
  698. X    for (i=0; i<poly->numVtces; ++i)
  699. X        poly->vertex[i] = tmp[i];
  700. X
  701. X    return poly;
  702. X}
  703. END_OF_FILE
  704. if test 537 -ne `wc -c <'acm/V/lib/VGetPlanes.c'`; then
  705.     echo shar: \"'acm/V/lib/VGetPlanes.c'\" unpacked with wrong size!
  706. fi
  707. # end of 'acm/V/lib/VGetPlanes.c'
  708. fi
  709. if test -f 'acm/V/lib/VIdentMat.c' -a "${1}" != "-c" ; then 
  710.   echo shar: Will not clobber existing file \"'acm/V/lib/VIdentMat.c'\"
  711. else
  712. echo shar: Extracting \"'acm/V/lib/VIdentMat.c'\" \(194 characters\)
  713. sed "s/^X//" >'acm/V/lib/VIdentMat.c' <<'END_OF_FILE'
  714. X#include "Vlib.h"
  715. X
  716. Xvoid VIdentMatrix (Mtx)
  717. XVMatrix *Mtx;
  718. X{
  719. X    short I, J;
  720. X
  721. X    for (I=0; I<4; ++I)
  722. X        for (J=0; J<4; ++J)
  723. X            if (I == J)
  724. X                (*Mtx).m[I][J] = 1.0;
  725. X            else
  726. X                (*Mtx).m[I][J] = 0.0;
  727. X
  728. X}
  729. END_OF_FILE
  730. if test 194 -ne `wc -c <'acm/V/lib/VIdentMat.c'`; then
  731.     echo shar: \"'acm/V/lib/VIdentMat.c'\" unpacked with wrong size!
  732. fi
  733. # end of 'acm/V/lib/VIdentMat.c'
  734. fi
  735. if test -f 'acm/V/lib/VMatDet.c' -a "${1}" != "-c" ; then 
  736.   echo shar: Will not clobber existing file \"'acm/V/lib/VMatDet.c'\"
  737. else
  738. echo shar: Extracting \"'acm/V/lib/VMatDet.c'\" \(564 characters\)
  739. sed "s/^X//" >'acm/V/lib/VMatDet.c' <<'END_OF_FILE'
  740. X#include "Vlib.h"
  741. X
  742. Xdouble VMatrixDeterminant(m)
  743. XVMatrix *m; {
  744. X
  745. X    double    det;
  746. X
  747. X    det = m->m[0][0] * m->m[1][1] * m->m[2][2] * m->m[3][3] +
  748. X          m->m[1][0] * m->m[2][1] * m->m[3][2] * m->m[0][3] +
  749. X          m->m[2][0] * m->m[3][1] * m->m[0][2] * m->m[1][3] +
  750. X          m->m[3][0] * m->m[0][1] * m->m[1][2] * m->m[2][3] -
  751. X          m->m[0][3] * m->m[1][2] * m->m[2][1] * m->m[3][0] -
  752. X          m->m[1][3] * m->m[2][2] * m->m[3][1] * m->m[0][0] -
  753. X          m->m[2][3] * m->m[3][2] * m->m[0][1] * m->m[1][0] -
  754. X          m->m[3][3] * m->m[0][2] * m->m[1][1] * m->m[2][0];
  755. X
  756. X    return det;
  757. X}
  758. END_OF_FILE
  759. if test 564 -ne `wc -c <'acm/V/lib/VMatDet.c'`; then
  760.     echo shar: \"'acm/V/lib/VMatDet.c'\" unpacked with wrong size!
  761. fi
  762. # end of 'acm/V/lib/VMatDet.c'
  763. fi
  764. if test -f 'acm/V/lib/VMatInvert.c' -a "${1}" != "-c" ; then 
  765.   echo shar: Will not clobber existing file \"'acm/V/lib/VMatInvert.c'\"
  766. else
  767. echo shar: Extracting \"'acm/V/lib/VMatInvert.c'\" \(405 characters\)
  768. sed "s/^X//" >'acm/V/lib/VMatInvert.c' <<'END_OF_FILE'
  769. X#include "Vlib.h"
  770. X
  771. X#define mod(a)    (a < 0 ? a + 3 : a % 3)
  772. X
  773. XVMatrix *VMatrixInvert(s, d)
  774. XVMatrix *s;
  775. XVMatrix *d; {
  776. X
  777. X    register int    i, j;
  778. X    register double det;
  779. X
  780. X    det = VMatrixDeterminant (s);
  781. X
  782. X    for (i=0; i<4; ++i)
  783. X        for (j=0; j<4; ++j)
  784. X            d->m[j][i] =(s->m[mod(j+1)][mod(i+1)] *
  785. X                     s->m[mod(j+2)][mod(i+2)] -
  786. X                     s->m[mod(j-1)][mod(i+1)] *
  787. X                     s->m[mod(j-2)][mod(i+2)] ) / det;
  788. X
  789. X    return d;
  790. X}
  791. END_OF_FILE
  792. if test 405 -ne `wc -c <'acm/V/lib/VMatInvert.c'`; then
  793.     echo shar: \"'acm/V/lib/VMatInvert.c'\" unpacked with wrong size!
  794. fi
  795. # end of 'acm/V/lib/VMatInvert.c'
  796. fi
  797. if test -f 'acm/V/lib/VMatMult.c' -a "${1}" != "-c" ; then 
  798.   echo shar: Will not clobber existing file \"'acm/V/lib/VMatMult.c'\"
  799. else
  800. echo shar: Extracting \"'acm/V/lib/VMatMult.c'\" \(247 characters\)
  801. sed "s/^X//" >'acm/V/lib/VMatMult.c' <<'END_OF_FILE'
  802. X#include "Vlib.h"
  803. X
  804. Xvoid VMatrixMult (Mt1, Mt2, R)
  805. XVMatrix *Mt1, *Mt2, *R; {
  806. X    short I, J, K;
  807. X
  808. X    for (I=0; I<4; ++I)
  809. X        for (J=0; J<4; ++J) {
  810. X            R->m[I][J] = 0.0;
  811. X            for (K=0; K<4; ++K)
  812. X                R->m[I][J] = R->m[I][J] + Mt1->m[K][J] * Mt2->m[I][K];
  813. X        }
  814. X}
  815. END_OF_FILE
  816. if test 247 -ne `wc -c <'acm/V/lib/VMatMult.c'`; then
  817.     echo shar: \"'acm/V/lib/VMatMult.c'\" unpacked with wrong size!
  818. fi
  819. # end of 'acm/V/lib/VMatMult.c'
  820. fi
  821. if test -f 'acm/V/lib/VPrintPoly.c' -a "${1}" != "-c" ; then 
  822.   echo shar: Will not clobber existing file \"'acm/V/lib/VPrintPoly.c'\"
  823. else
  824. echo shar: Extracting \"'acm/V/lib/VPrintPoly.c'\" \(455 characters\)
  825. sed "s/^X//" >'acm/V/lib/VPrintPoly.c' <<'END_OF_FILE'
  826. X#include "Vlib.h"
  827. X
  828. Xvoid    VPrintPolygon (file, p)
  829. XFILE    *file;
  830. XVPolygon *p; {
  831. X
  832. X    int    i;
  833. X    char    *nullPoly = "*** Null Polygon ***\n";
  834. X
  835. X    if (p == (VPolygon *) NULL)
  836. X        fprintf (file, nullPoly);
  837. X    else {
  838. X        if (p->numVtces == 0) {
  839. X            fprintf (file, nullPoly);
  840. X            return;
  841. X        }
  842. X
  843. X        fprintf (file, "%d vertices:\n", p->numVtces);
  844. X
  845. X        for (i=0; i<p->numVtces; ++i)
  846. X            fprintf(file, "%9.6g %9.6g %9.6g\n", p->vertex[i].x,
  847. X                p->vertex[i].y, p->vertex[i].z);
  848. X    }
  849. X
  850. X    return;
  851. X}
  852. END_OF_FILE
  853. if test 455 -ne `wc -c <'acm/V/lib/VPrintPoly.c'`; then
  854.     echo shar: \"'acm/V/lib/VPrintPoly.c'\" unpacked with wrong size!
  855. fi
  856. # end of 'acm/V/lib/VPrintPoly.c'
  857. fi
  858. if test -f 'acm/V/lib/VReadObject.c' -a "${1}" != "-c" ; then 
  859.   echo shar: Will not clobber existing file \"'acm/V/lib/VReadObject.c'\"
  860. else
  861. echo shar: Extracting \"'acm/V/lib/VReadObject.c'\" \(1079 characters\)
  862. sed "s/^X//" >'acm/V/lib/VReadObject.c' <<'END_OF_FILE'
  863. X#include "Vlib.h"
  864. X#include <string.h>
  865. X
  866. XVObject *VReadObject(f)
  867. XFILE *f; {
  868. X
  869. X    short    I, J, vertex, vertices, NumPts, NumPolys;
  870. X    float    x, y, z;
  871. X    char    str[64], name[128];
  872. X    VPoint    *tmpPts, pts[VmaxVP];
  873. X    VPolygon **polygons;
  874. X    VObject    *object;
  875. X
  876. X    fscanf(f, "%s\n", name);
  877. X    fscanf(f, "%hd", &NumPts);
  878. X    fscanf(f, "%hd", &NumPolys);
  879. X
  880. X    tmpPts = (VPoint *) Vmalloc (NumPts * sizeof(VPoint));
  881. X    polygons = (VPolygon **) Vmalloc (NumPolys * sizeof(VPolygon *));
  882. X
  883. X    for (I=0; I<NumPts; ++I) {
  884. X        fscanf(f, "%hd", &J);
  885. X        fscanf(f, "%f", &x);
  886. X        fscanf(f, "%f", &y);
  887. X        fscanf(f, "%f", &z);
  888. X        tmpPts[I].x = x;
  889. X        tmpPts[I].y = y;
  890. X        tmpPts[I].z = z;
  891. X    }
  892. X
  893. X    for (I=0; I<NumPolys; ++I) {
  894. X        fscanf(f, "%s %hd", str, &(vertices));
  895. X        for (J=0; J<vertices; ++J) {
  896. X            fscanf(f, "%hd", &(vertex));
  897. X            pts[J] = tmpPts[vertex - 1];
  898. X        }
  899. X        polygons[I] = VCreatePolygon (vertices, pts, VAllocColor(str));
  900. X    }
  901. X
  902. X    object = (VObject *) Vmalloc (sizeof(VObject));
  903. X    object->name = strdup (name);
  904. X    object->numPolys = NumPolys;
  905. X    object->polygon = polygons;
  906. X
  907. X    free ((char *) tmpPts);
  908. X    return ferror(f) ? (VObject *) 0 : object;
  909. X}
  910. END_OF_FILE
  911. if test 1079 -ne `wc -c <'acm/V/lib/VReadObject.c'`; then
  912.     echo shar: \"'acm/V/lib/VReadObject.c'\" unpacked with wrong size!
  913. fi
  914. # end of 'acm/V/lib/VReadObject.c'
  915. fi
  916. if test -f 'acm/V/lib/VResizeVp.c' -a "${1}" != "-c" ; then 
  917.   echo shar: Will not clobber existing file \"'acm/V/lib/VResizeVp.c'\"
  918. else
  919. echo shar: Extracting \"'acm/V/lib/VResizeVp.c'\" \(1518 characters\)
  920. sed "s/^X//" >'acm/V/lib/VResizeVp.c' <<'END_OF_FILE'
  921. X#include "Vlib.h"
  922. X
  923. Xvoid VResizeViewport (v, unit, dist, scale, width, height)
  924. XViewport     *v;
  925. Xdouble  unit;
  926. Xdouble  dist;
  927. Xdouble  scale;
  928. Xint    width;
  929. Xint    height; {
  930. X
  931. X    VPoint     clip[4];
  932. X
  933. X/*
  934. X *  Allocate a new monochrome bitmap to buffer the displayed image.
  935. X */
  936. X
  937. X    if (v->flags & VPPixmap) {
  938. X        XFreePixmap (v->dpy, v->monoPixmap);
  939. X        v->monoPixmap = XCreatePixmap (v->dpy,
  940. X            RootWindow(v->dpy, v->screen), v->width, v->height,
  941. X            DisplayPlanes (v->dpy, v->screen));
  942. X    }
  943. X
  944. X/*
  945. X * Calculate screen resolution in pixels per unit.
  946. X */
  947. X
  948. X    v->dist = dist;
  949. X    v->units = unit;
  950. X
  951. X/*
  952. X *  Use that info to set scaling factors.
  953. X */
  954. X
  955. X        v->Scale.x = v->xres * dist * scale;
  956. X        v->Scale.y = v->yres * dist * scale;
  957. X        v->Scale.z = 1.0;
  958. X
  959. X        v->Middl.x = (double) width / 2.0;
  960. X        v->Middl.y = (double) height / 2.0;
  961. X        v->Middl.z = 0.0;
  962. X
  963. X/*
  964. X *  Build the clipping planes for our view into the eye space.
  965. X */
  966. X
  967. X        clip[0].x = - width / v->xres / 2.0 / scale;
  968. X        clip[0].y = - height / v->yres / 2.0 / scale;
  969. X        clip[0].z = dist;
  970. X        clip[1].x = - width / v->xres / 2.0 / scale;
  971. X        clip[1].y = height / v->yres / 2.0 / scale;
  972. X        clip[1].z = dist;
  973. X        clip[2].x = width / v->xres / 2.0 / scale;
  974. X        clip[2].y = height / v->yres / 2.0 / scale;
  975. X        clip[2].z = dist;
  976. X        clip[3].x = width / v->xres / 2.0 / scale;
  977. X        clip[3].y = - height / v->yres / 2.0 / scale;
  978. X        clip[3].z = dist;
  979. X
  980. X        v->clipPoly = VCreatePolygon (4, clip);
  981. X        VGetPlanes (v->clipPoly);
  982. X}
  983. END_OF_FILE
  984. if test 1518 -ne `wc -c <'acm/V/lib/VResizeVp.c'`; then
  985.     echo shar: \"'acm/V/lib/VResizeVp.c'\" unpacked with wrong size!
  986. fi
  987. # end of 'acm/V/lib/VResizeVp.c'
  988. fi
  989. if test -f 'acm/V/lib/VRotate.c' -a "${1}" != "-c" ; then 
  990.   echo shar: Will not clobber existing file \"'acm/V/lib/VRotate.c'\"
  991. else
  992. echo shar: Extracting \"'acm/V/lib/VRotate.c'\" \(961 characters\)
  993. sed "s/^X//" >'acm/V/lib/VRotate.c' <<'END_OF_FILE'
  994. X#include "Vlib.h"
  995. X#include <math.h>
  996. X
  997. XVMatrix *VRotate (Mt1, operation, angle)
  998. XVMatrix * Mt1;
  999. Xint    operation;
  1000. Xdouble    angle; {
  1001. X
  1002. X    VMatrix    m, s;
  1003. X
  1004. X    VIdentMatrix (&m);
  1005. X
  1006. X    switch (operation) {
  1007. X    case XRotation:
  1008. X        m.m[1][1] = m.m[2][2] = cos(angle);
  1009. X        m.m[2][1] = sin(angle);
  1010. X        m.m[1][2] = - m.m[2][1];
  1011. X        break;
  1012. X    case YRotation: 
  1013. X        m.m[0][0] = m.m[2][2] = cos(angle);
  1014. X        m.m[2][0] = sin(angle);
  1015. X        m.m[0][2] = - m.m[2][0];
  1016. X        break;
  1017. X    case ZRotation:
  1018. X        m.m[0][0] = m.m[1][1] = cos(angle);
  1019. X        m.m[1][0] = sin(angle);
  1020. X        m.m[0][1] = - m.m[1][0];
  1021. X        break;
  1022. X    }
  1023. X
  1024. X    s = *Mt1;
  1025. X
  1026. X    VMatrixMult (&s, &m, Mt1);
  1027. X    return Mt1;
  1028. X}
  1029. X
  1030. XVMatrix *VTranslatePoint (Mt, loc)
  1031. XVMatrix *Mt;
  1032. XVPoint  loc; {
  1033. X
  1034. X    Mt->m[0][3] = Mt->m[0][3] + loc.x;
  1035. X    Mt->m[1][3] = Mt->m[1][3] + loc.y;
  1036. X    Mt->m[2][3] = Mt->m[2][3] + loc.z;
  1037. X    return Mt;
  1038. X
  1039. X}
  1040. X
  1041. XVMatrix *VTranslate (Mt, x, y ,z)
  1042. XVMatrix *Mt;
  1043. Xdouble  x, y, z; {
  1044. X
  1045. X    Mt->m[0][3] = Mt->m[0][3] + x;
  1046. X    Mt->m[1][3] = Mt->m[1][3] + y;
  1047. X    Mt->m[2][3] = Mt->m[2][3] + z;
  1048. X    return Mt;
  1049. X}
  1050. END_OF_FILE
  1051. if test 961 -ne `wc -c <'acm/V/lib/VRotate.c'`; then
  1052.     echo shar: \"'acm/V/lib/VRotate.c'\" unpacked with wrong size!
  1053. fi
  1054. # end of 'acm/V/lib/VRotate.c'
  1055. fi
  1056. if test -f 'acm/V/lib/VTrans.c' -a "${1}" != "-c" ; then 
  1057.   echo shar: Will not clobber existing file \"'acm/V/lib/VTrans.c'\"
  1058. else
  1059. echo shar: Extracting \"'acm/V/lib/VTrans.c'\" \(464 characters\)
  1060. sed "s/^X//" >'acm/V/lib/VTrans.c' <<'END_OF_FILE'
  1061. X#include "Vlib.h"
  1062. X
  1063. X/*
  1064. X * VTransform: transform a point from one coordinate system to another.
  1065. X */
  1066. X
  1067. Xvoid VTransform (pt, mt, newPt)
  1068. XVPoint    *pt;
  1069. XVMatrix *mt;
  1070. XVPoint    *newPt; {
  1071. X
  1072. X  newPt->x = pt->x * mt->m[0][0] + pt->y * mt->m[0][1]
  1073. X        + pt->z * mt->m[0][2] + mt->m[0][3];
  1074. X
  1075. X  newPt->y = pt->x * mt->m[1][0] + pt->y * mt->m[1][1]
  1076. X          + pt->z * mt->m[1][2] + mt->m[1][3];
  1077. X
  1078. X  newPt->z = pt->x * mt->m[2][0] + pt->y * mt->m[2][1]
  1079. X          + pt->z * mt->m[2][2] + mt->m[2][3];
  1080. X}
  1081. END_OF_FILE
  1082. if test 464 -ne `wc -c <'acm/V/lib/VTrans.c'`; then
  1083.     echo shar: \"'acm/V/lib/VTrans.c'\" unpacked with wrong size!
  1084. fi
  1085. # end of 'acm/V/lib/VTrans.c'
  1086. fi
  1087. if test -f 'acm/V/lib/VTransPoly.c' -a "${1}" != "-c" ; then 
  1088.   echo shar: Will not clobber existing file \"'acm/V/lib/VTransPoly.c'\"
  1089. else
  1090. echo shar: Extracting \"'acm/V/lib/VTransPoly.c'\" \(235 characters\)
  1091. sed "s/^X//" >'acm/V/lib/VTransPoly.c' <<'END_OF_FILE'
  1092. X#include "Vlib.h"
  1093. X
  1094. XVPolygon *VTransformPolygon (poly, m)
  1095. XVPolygon *poly;
  1096. XVMatrix *m; {
  1097. X
  1098. X    int    i;
  1099. X    VPoint    tmp;
  1100. X
  1101. X    for (i=0; i<poly->numVtces; ++i) {
  1102. X        VTransform (&(poly->vertex[i]), m, &tmp);
  1103. X        poly->vertex[i] = tmp;
  1104. X    }
  1105. X
  1106. X    return poly;
  1107. X}
  1108. END_OF_FILE
  1109. if test 235 -ne `wc -c <'acm/V/lib/VTransPoly.c'`; then
  1110.     echo shar: \"'acm/V/lib/VTransPoly.c'\" unpacked with wrong size!
  1111. fi
  1112. # end of 'acm/V/lib/VTransPoly.c'
  1113. fi
  1114. if test -f 'acm/V/lib/VWorldToScr.c' -a "${1}" != "-c" ; then 
  1115.   echo shar: Will not clobber existing file \"'acm/V/lib/VWorldToScr.c'\"
  1116. else
  1117. echo shar: Extracting \"'acm/V/lib/VWorldToScr.c'\" \(375 characters\)
  1118. sed "s/^X//" >'acm/V/lib/VWorldToScr.c' <<'END_OF_FILE'
  1119. X#include "Vlib.h"
  1120. X
  1121. X/*
  1122. X *  Transform a 3-D point in the world system into viewable
  1123. X *  coordinates.  The function returns 1 if the x,y information is
  1124. X *  displayable (probably displayable, that is).
  1125. X */
  1126. X
  1127. Xint VWorldToScreen (v, p, x, y)
  1128. XViewport    *v;
  1129. XVPoint        *p;
  1130. Xint        *x, *y; {
  1131. X
  1132. X    VPoint    eyept;
  1133. X
  1134. X    VTransform (p, &(v->eyeSpace), &eyept);
  1135. X    return VEyeToScreen (v, &eyept, x, y);
  1136. X}
  1137. END_OF_FILE
  1138. if test 375 -ne `wc -c <'acm/V/lib/VWorldToScr.c'`; then
  1139.     echo shar: \"'acm/V/lib/VWorldToScr.c'\" unpacked with wrong size!
  1140. fi
  1141. # end of 'acm/V/lib/VWorldToScr.c'
  1142. fi
  1143. if test -f 'acm/V/lib/VWriteObject.c' -a "${1}" != "-c" ; then 
  1144.   echo shar: Will not clobber existing file \"'acm/V/lib/VWriteObject.c'\"
  1145. else
  1146. echo shar: Extracting \"'acm/V/lib/VWriteObject.c'\" \(914 characters\)
  1147. sed "s/^X//" >'acm/V/lib/VWriteObject.c' <<'END_OF_FILE'
  1148. X#include "Vlib.h"
  1149. X#include <string.h>
  1150. X
  1151. Xint VWriteObject(f, obj)
  1152. XFILE    *f;
  1153. XVObject *obj; {
  1154. X
  1155. X    int     i, j, k, points;
  1156. X    VPolygon **q;
  1157. X    VPoint     *p;
  1158. X
  1159. X/*
  1160. X *  Total the number of vertices in all of the object's polygons
  1161. X */
  1162. X
  1163. X    points = 0;
  1164. X    q = obj->polygon;
  1165. X    for (i=0; i<obj->numPolys; ++i) {
  1166. X        points += q[i]->numVtces;
  1167. X    }
  1168. X
  1169. X/*
  1170. X *  Print the header
  1171. X */
  1172. X
  1173. X    fprintf (f, "%s\n%d %d\n", obj->name, points, obj->numPolys);
  1174. X
  1175. X/*
  1176. X *  Print the point list
  1177. X */
  1178. X
  1179. X    k = 1;
  1180. X    q = obj->polygon;
  1181. X    for (i=0; i<obj->numPolys; ++i) {
  1182. X        for ((j=0, p=q[i]->vertex); j<q[i]->numVtces; (++p, ++j)) {
  1183. X            fprintf(f, "%d %g %g %g\n", k, p->x, p->y, p->z);
  1184. X            ++k;
  1185. X        }
  1186. X    }
  1187. X
  1188. X/*
  1189. X *  Print the polygon list
  1190. X */
  1191. X
  1192. X    k = 1;
  1193. X    q = obj->polygon;
  1194. X    for (i=0; i<obj->numPolys; ++i) {
  1195. X        fprintf(f, "%s %d", q[i]->color->color_name, q[i]->numVtces);
  1196. X        for (j=0; j<q[i]->numVtces; ++j)
  1197. X            fprintf(f, " %d", k++);
  1198. X        fprintf (f, "\n");
  1199. X    }
  1200. X
  1201. X    return ferror(f) ? -1 : 0;
  1202. X}
  1203. END_OF_FILE
  1204. if test 914 -ne `wc -c <'acm/V/lib/VWriteObject.c'`; then
  1205.     echo shar: \"'acm/V/lib/VWriteObject.c'\" unpacked with wrong size!
  1206. fi
  1207. # end of 'acm/V/lib/VWriteObject.c'
  1208. fi
  1209. if test -f 'acm/V/lib/Vmalloc.c' -a "${1}" != "-c" ; then 
  1210.   echo shar: Will not clobber existing file \"'acm/V/lib/Vmalloc.c'\"
  1211. else
  1212. echo shar: Extracting \"'acm/V/lib/Vmalloc.c'\" \(299 characters\)
  1213. sed "s/^X//" >'acm/V/lib/Vmalloc.c' <<'END_OF_FILE'
  1214. X#include "Vlib.h"
  1215. X
  1216. Xextern char * malloc();
  1217. X
  1218. Xchar *Vmalloc(size)
  1219. Xint    size; {
  1220. X
  1221. X    char    *p;
  1222. X
  1223. X    if ((p = malloc(size)) == (char *) NULL) {
  1224. X        fprintf (stderr, "V package memory allocation error.\n");
  1225. X        fprintf (stderr, "An error was encountered allocating\
  1226. X %d bytes.\n", size);
  1227. X        exit (1);
  1228. X    }
  1229. X    return p;
  1230. X}
  1231. END_OF_FILE
  1232. if test 299 -ne `wc -c <'acm/V/lib/Vmalloc.c'`; then
  1233.     echo shar: \"'acm/V/lib/Vmalloc.c'\" unpacked with wrong size!
  1234. fi
  1235. # end of 'acm/V/lib/Vmalloc.c'
  1236. fi
  1237. if test -f 'acm/V/lib/strdup.c' -a "${1}" != "-c" ; then 
  1238.   echo shar: Will not clobber existing file \"'acm/V/lib/strdup.c'\"
  1239. else
  1240. echo shar: Extracting \"'acm/V/lib/strdup.c'\" \(180 characters\)
  1241. sed "s/^X//" >'acm/V/lib/strdup.c' <<'END_OF_FILE'
  1242. X#include <string.h>
  1243. X#include "Vlib.h"
  1244. X
  1245. X#ifndef SYSV
  1246. X
  1247. Xchar *strdup(string)
  1248. Xchar *string;
  1249. X{
  1250. X     return(strcpy(Vmalloc(sizeof(char) * (strlen(string) + 1)),
  1251. X           string));
  1252. X}
  1253. X
  1254. X#endif
  1255. END_OF_FILE
  1256. if test 180 -ne `wc -c <'acm/V/lib/strdup.c'`; then
  1257.     echo shar: \"'acm/V/lib/strdup.c'\" unpacked with wrong size!
  1258. fi
  1259. # end of 'acm/V/lib/strdup.c'
  1260. fi
  1261. if test ! -d 'acm/V/test' ; then
  1262.     echo shar: Creating directory \"'acm/V/test'\"
  1263.     mkdir 'acm/V/test'
  1264. fi
  1265. if test -f 'acm/V/test/Imakefile' -a "${1}" != "-c" ; then 
  1266.   echo shar: Will not clobber existing file \"'acm/V/test/Imakefile'\"
  1267. else
  1268. echo shar: Extracting \"'acm/V/test/Imakefile'\" \(144 characters\)
  1269. sed "s/^X//" >'acm/V/test/Imakefile' <<'END_OF_FILE'
  1270. X#include "../../acm.def"
  1271. X
  1272. XSRCS=            animate.c app.c
  1273. XOBJS=            animate.o app.o
  1274. XSYS_LIBRARIES=        -L../lib -lV -lm -lX11
  1275. X
  1276. XComplexProgramTarget(animate)
  1277. END_OF_FILE
  1278. if test 144 -ne `wc -c <'acm/V/test/Imakefile'`; then
  1279.     echo shar: \"'acm/V/test/Imakefile'\" unpacked with wrong size!
  1280. fi
  1281. # end of 'acm/V/test/Imakefile'
  1282. fi
  1283. if test -f 'acm/V/test/fixf16.c' -a "${1}" != "-c" ; then 
  1284.   echo shar: Will not clobber existing file \"'acm/V/test/fixf16.c'\"
  1285. else
  1286. echo shar: Extracting \"'acm/V/test/fixf16.c'\" \(801 characters\)
  1287. sed "s/^X//" >'acm/V/test/fixf16.c' <<'END_OF_FILE'
  1288. X#include "../lib/Vlib.h"
  1289. X
  1290. Xmain () {
  1291. X
  1292. X    int    i, k;
  1293. X    VObject *obj;
  1294. X    VPolygon **poly;
  1295. X    VPoint    *q, tmp;
  1296. X    VMatrix mtx;
  1297. X
  1298. X        if ((obj = VReadObject(stdin)) == (VObject *) NULL) {
  1299. X                fprintf (stderr, "Error reading the object definition.\n");
  1300. X                exit (1);
  1301. X        }
  1302. X
  1303. X/*
  1304. X *  Prepare a transformation matrix that:
  1305. X *    (a) swaps X and Y coordinates.
  1306. X *    (b) negates Z coordinate.
  1307. X */
  1308. X
  1309. X    VIdentMatrix (&mtx);
  1310. X    mtx.m[0][0] = 0.0;
  1311. X    mtx.m[0][1] = 1.0;
  1312. X    mtx.m[1][0] = 1.0;
  1313. X    mtx.m[1][1] = 0.0;
  1314. X    mtx.m[2][2] = -1.0;
  1315. X
  1316. X    poly = obj->polygon;
  1317. X
  1318. X        for (i=0; i<obj->numPolys; ++i) {
  1319. X            for ((k=0, q=poly[i]->vertex); k<poly[i]->numVtces; (++k, ++q)) {
  1320. X                    VTransform(q, &mtx, &tmp);
  1321. X                    *q = tmp;
  1322. X            }
  1323. X        }
  1324. X
  1325. X    VWriteObject (stdout, obj);
  1326. X}
  1327. END_OF_FILE
  1328. if test 801 -ne `wc -c <'acm/V/test/fixf16.c'`; then
  1329.     echo shar: \"'acm/V/test/fixf16.c'\" unpacked with wrong size!
  1330. fi
  1331. # end of 'acm/V/test/fixf16.c'
  1332. fi
  1333. if test -f 'acm/V/test/fixmig.c' -a "${1}" != "-c" ; then 
  1334.   echo shar: Will not clobber existing file \"'acm/V/test/fixmig.c'\"
  1335. else
  1336. echo shar: Extracting \"'acm/V/test/fixmig.c'\" \(795 characters\)
  1337. sed "s/^X//" >'acm/V/test/fixmig.c' <<'END_OF_FILE'
  1338. X#include "../lib/Vlib.h"
  1339. X
  1340. Xmain () {
  1341. X
  1342. X    int    i, k;
  1343. X    VObject *obj;
  1344. X    VPolygon **poly;
  1345. X    VPoint    *q, tmp;
  1346. X    VMatrix mtx;
  1347. X
  1348. X        if ((obj = VReadObject(stdin)) == (VObject *) NULL) {
  1349. X                fprintf (stderr, "Error reading the object definition.\n");
  1350. X                exit (1);
  1351. X        }
  1352. X
  1353. X/*
  1354. X *  Prepare a transformation matrix that:
  1355. X *    (a) swaps X and Y coordinates.
  1356. X *    (b) negates Z coordinate.
  1357. X */
  1358. X
  1359. X    VIdentMatrix (&mtx);
  1360. X    mtx.m[0][3] = 39.60232;
  1361. X    mtx.m[0][0] = -2.1523;
  1362. X    mtx.m[1][1] = 2.1523;
  1363. X    mtx.m[2][2] = 2.1523;
  1364. X
  1365. X    poly = obj->polygon;
  1366. X
  1367. X        for (i=0; i<obj->numPolys; ++i) {
  1368. X            for ((k=0, q=poly[i]->vertex); k<poly[i]->numVtces; (++k, ++q)) {
  1369. X                    VTransform(q, &mtx, &tmp);
  1370. X                    *q = tmp;
  1371. X            }
  1372. X        }
  1373. X
  1374. X    VWriteObject (stdout, obj);
  1375. X}
  1376. END_OF_FILE
  1377. if test 795 -ne `wc -c <'acm/V/test/fixmig.c'`; then
  1378.     echo shar: \"'acm/V/test/fixmig.c'\" unpacked with wrong size!
  1379. fi
  1380. # end of 'acm/V/test/fixmig.c'
  1381. fi
  1382. if test -f 'acm/acm.def' -a "${1}" != "-c" ; then 
  1383.   echo shar: Will not clobber existing file \"'acm/acm.def'\"
  1384. else
  1385. echo shar: Extracting \"'acm/acm.def'\" \(534 characters\)
  1386. sed "s/^X//" >'acm/acm.def' <<'END_OF_FILE'
  1387. X/*
  1388. X *  I run imake all without all the other X11Rx stuff on my system.
  1389. X *
  1390. X *  To facilitate this, I override a few imake parameters.
  1391. X *
  1392. X *  To make the changes I invoke imake this way:
  1393. X *
  1394. X *    % imake -DStandAloneImake ...
  1395. X *
  1396. X *  If you use this, you will surely want to modify some of these
  1397. X *  paths.
  1398. X */
  1399. X
  1400. X#ifdef StandAloneImake
  1401. XTOP = .
  1402. XIMAKE = /people/riley/bin/imake
  1403. XIRULESRC = /usr/lib/local/imake.includes
  1404. XIMAKE_DEFINES = -DStandAloneImake
  1405. XIMAKE_CMD = $(IMAKE) -s Makefile $(IMAKE_DEFINES)
  1406. X#endif
  1407. X
  1408. XCDEBUGFLAGS = -systype bsd43 -O
  1409. END_OF_FILE
  1410. if test 534 -ne `wc -c <'acm/acm.def'`; then
  1411.     echo shar: \"'acm/acm.def'\" unpacked with wrong size!
  1412. fi
  1413. # end of 'acm/acm.def'
  1414. fi
  1415. if test ! -d 'acm/fsim' ; then
  1416.     echo shar: Creating directory \"'acm/fsim'\"
  1417.     mkdir 'acm/fsim'
  1418. fi
  1419. if test -f 'acm/fsim/V2tgif.c' -a "${1}" != "-c" ; then 
  1420.   echo shar: Will not clobber existing file \"'acm/fsim/V2tgif.c'\"
  1421. else
  1422. echo shar: Extracting \"'acm/fsim/V2tgif.c'\" \(1441 characters\)
  1423. sed "s/^X//" >'acm/fsim/V2tgif.c' <<'END_OF_FILE'
  1424. X#include <stdio.h>
  1425. X#include <Vlib.h>
  1426. X
  1427. X#define INCHES    128
  1428. X
  1429. Xint    horg = 4 * INCHES;
  1430. Xint    vorg = 5 * INCHES;
  1431. Xdouble    scale = ((double) INCHES / 4.0);    /* 4 feet to the inch */
  1432. X
  1433. X#define    XAXIS    1
  1434. X#define YAXIS    2
  1435. X#define ZAXIS    3
  1436. Xint    axis = XAXIS;
  1437. X
  1438. Xextern char * optarg;
  1439. X
  1440. Xmain (argc, argv)
  1441. Xint    argc;
  1442. Xchar     *argv[]; {
  1443. X
  1444. X    VObject    *object;
  1445. X    char    *name;
  1446. X    FILE    *f;
  1447. X    int    c, i, j, k, n;
  1448. X    int    v, h;
  1449. X    VPoint    *q, tmp;
  1450. X    VMatrix     mtx;
  1451. X    VPolygon **p;
  1452. X
  1453. X    while ((c = getopt (argc, argv, "f:xyz")) != EOF) {
  1454. X
  1455. X        switch (c) {
  1456. X
  1457. X        case 'f':
  1458. X            name = optarg;
  1459. X            break;
  1460. X
  1461. X        case 'x':
  1462. X            axis = XAXIS;
  1463. X            break;
  1464. X
  1465. X        case 'y':
  1466. X            axis = YAXIS;
  1467. X            break;
  1468. X
  1469. X        case 'z':
  1470. X            axis = ZAXIS;
  1471. X            break;
  1472. X        }
  1473. X    }
  1474. X
  1475. X    f = fopen (name, "r");
  1476. X    object = VReadObject(f);
  1477. X    fclose (f);
  1478. X
  1479. X    printf ("state(0,6,0,0,0,16,1,4,1,1,0,0,1,0,1,0,1,0,4).\n");
  1480. X
  1481. X    n = object->numPolys;
  1482. X    p = object->polygon;
  1483. X    for (i=0; i<n; ++i) {
  1484. X        printf ("polygon(yellow,%d,[", p[i]->numVtces+1);
  1485. X        for ((k=0, q=p[i]->vertex); k<p[i]->numVtces; (++k, ++q)) {
  1486. X            transform (q, &v, &h);
  1487. X            printf ("%d,%d,", v, h);    
  1488. X        }
  1489. X        transform (p[i]->vertex, &v, &h);
  1490. X        printf ("%d,%d],0,0,1,0).\n", v, h);
  1491. X        ++j;
  1492. X    }
  1493. X
  1494. X    exit (0);
  1495. X}
  1496. X
  1497. Xtransform (p, y, x)
  1498. XVPoint    *p;
  1499. Xint    *y, *x; {
  1500. X
  1501. X    double    dx, dy;
  1502. X
  1503. X    if (axis == XAXIS) {
  1504. X        dx = p->y;
  1505. X        dy = p->z;
  1506. X    }
  1507. X    else if (axis == YAXIS) {
  1508. X        dx = p->x;
  1509. X        dy = p->z;
  1510. X    }
  1511. X    else if (axis == ZAXIS) {
  1512. X        dx = p->x;
  1513. X        dy = p->y;
  1514. X    }
  1515. X
  1516. X    *x = (int) (dx * scale + 0.5) + vorg;
  1517. X    *y = (int) (dy * scale + 0.5) + horg;
  1518. X}
  1519. X    
  1520. END_OF_FILE
  1521. if test 1441 -ne `wc -c <'acm/fsim/V2tgif.c'`; then
  1522.     echo shar: \"'acm/fsim/V2tgif.c'\" unpacked with wrong size!
  1523. fi
  1524. # end of 'acm/fsim/V2tgif.c'
  1525. fi
  1526. if test -f 'acm/fsim/aim-9' -a "${1}" != "-c" ; then 
  1527.   echo shar: Will not clobber existing file \"'acm/fsim/aim-9'\"
  1528. else
  1529. echo shar: Extracting \"'acm/fsim/aim-9'\" \(1345 characters\)
  1530. sed "s/^X//" >'acm/fsim/aim-9' <<'END_OF_FILE'
  1531. X#
  1532. X66 5
  1533. X1 -0.9167 0 0
  1534. X2 -0.9167 0.0833 0
  1535. X3 -1 0.1667 0
  1536. X4 -1.6667 0.25 0
  1537. X5 -1.8333 0.25 0
  1538. X6 -2.3333 0.8333 0
  1539. X7 -2.4167 1 0
  1540. X8 -2.4167 0.25 0
  1541. X9 -7.5833 0.25 0
  1542. X10 -8 1 0
  1543. X11 -9 1 0
  1544. X12 -9 -1 0
  1545. X13 -8 -1 0
  1546. X14 -7.5833 -0.25 0
  1547. X15 -2.4167 -0.25 0
  1548. X16 -2.4167 -1 0
  1549. X17 -2.3333 -0.8333 0
  1550. X18 -1.8333 -0.25 0
  1551. X19 -1.6667 -0.25 0
  1552. X20 -1 -0.1667 0
  1553. X21 -0.9167 -0.0833 0
  1554. X1 -0.9167 0 0
  1555. X2 -0.9167 0 0.0833
  1556. X3 -1 0 0.1667
  1557. X4 -1.6667 0 0.25
  1558. X5 -1.8333 0 0.25
  1559. X6 -2.3333 0 0.8333
  1560. X7 -2.4167 0 1
  1561. X8 -2.4167 0 0.25
  1562. X9 -7.5833 0 0.25
  1563. X10 -8 0 1
  1564. X11 -9 0 1
  1565. X12 -9 0 -1
  1566. X13 -8 0 -1
  1567. X14 -7.5833 0 -0.25
  1568. X15 -2.4167 0 -0.25
  1569. X16 -2.4167 0 -1
  1570. X17 -2.3333 0 -0.8333
  1571. X18 -1.8333 0 -0.25
  1572. X19 -1.6667 0 -0.25
  1573. X20 -1 0 -0.1667
  1574. X21 -0.9167 0 -0.0833
  1575. X43 -9 0.25 0
  1576. X44 -9 0.1768 0.1768
  1577. X45 -9 0 0.25
  1578. X46 -9 -0.1768 0.1768
  1579. X47 -9 -0.25 0
  1580. X48 -9 -0.1768 -0.1768
  1581. X49 -9 0 -0.25
  1582. X50 -9 0.1768 -0.1768
  1583. X51 -9 -0.25 0
  1584. X52 -9.75 -0.5 0
  1585. X53 -12 -0.75 0
  1586. X54 -13.5 -0.75 0
  1587. X55 -12.75 -0.5 0
  1588. X56 -15.25 -0.5 0
  1589. X57 -19.9167 0 0
  1590. X58 -15.0833 0.4167 0
  1591. X59 -15.75 0.5 0
  1592. X60 -12.5833 0.6667 0
  1593. X61 -12.0833 0.5833 0
  1594. X62 -9.833 0.5 0
  1595. X63 -9 0.25 0
  1596. X64 -12.5833 0 0.6667
  1597. X65 -12.5833 -0.6667 0
  1598. X66 -12.5833 0 -0.6667
  1599. Xwhite 21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
  1600. Xwhite 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
  1601. Xwhite 8 43 44 45 46 47 48 49 50
  1602. Xwhite 13 51 52 53 54 55 56 57 58 59 60 61 62 63
  1603. Xwhite 4 60 64 65 66
  1604. END_OF_FILE
  1605. if test 1345 -ne `wc -c <'acm/fsim/aim-9'`; then
  1606.     echo shar: \"'acm/fsim/aim-9'\" unpacked with wrong size!
  1607. fi
  1608. # end of 'acm/fsim/aim-9'
  1609. fi
  1610. if test -f 'acm/fsim/bullet' -a "${1}" != "-c" ; then 
  1611.   echo shar: Will not clobber existing file \"'acm/fsim/bullet'\"
  1612. else
  1613. echo shar: Extracting \"'acm/fsim/bullet'\" \(130 characters\)
  1614. sed "s/^X//" >'acm/fsim/bullet' <<'END_OF_FILE'
  1615. X*a-bullet
  1616. X6 3
  1617. X1 0 0 0
  1618. X2 -0.4 0.5 0
  1619. X3 -25.0 0 0
  1620. X4 -0.4 -0.5 0
  1621. X5 -0.4 0 0.5
  1622. X6 -0.4 0 -0.5
  1623. Xred 4 1 2 3 4
  1624. Xred 4 1 5 3 6
  1625. Xred 4 2 5 4 6
  1626. END_OF_FILE
  1627. if test 130 -ne `wc -c <'acm/fsim/bullet'`; then
  1628.     echo shar: \"'acm/fsim/bullet'\" unpacked with wrong size!
  1629. fi
  1630. # end of 'acm/fsim/bullet'
  1631. fi
  1632. if test -f 'acm/fsim/damage.h' -a "${1}" != "-c" ; then 
  1633.   echo shar: Will not clobber existing file \"'acm/fsim/damage.h'\"
  1634. else
  1635. echo shar: Extracting \"'acm/fsim/damage.h'\" \(960 characters\)
  1636. sed "s/^X//" >'acm/fsim/damage.h' <<'END_OF_FILE'
  1637. X#define isFunctioning(c, sys)    ((c->damageBits & sys) ? 1 : 0)
  1638. X
  1639. X/*
  1640. X *  Each of these bits are true if the corresponding system is
  1641. X *  functioning.
  1642. X */
  1643. X
  1644. X#define    SYS_RADAR    0x0001    /* set if radar works */
  1645. X#define SYS_TEWS    0x0002    /* set if TEWS works */
  1646. X#define SYS_FLAPS    0x0004    /* set if flaps work */
  1647. X#define SYS_SPEEDBRAKE    0x0008
  1648. X#define SYS_HYD1    0x0010
  1649. X#define SYS_HYD2    0x0020
  1650. X#define SYS_GEN1    0x0040
  1651. X#define SYS_GEN2    0x0080
  1652. X#define SYS_ENGINE1    0x0100    /* set if engine #1 works */
  1653. X#define SYS_ENGINE2    0x0200    /* set if engine #2 works */
  1654. X#define SYS_HUD        0x0400    /* set if HUD works */
  1655. X#define SYS_FUEL    0x0800    /* set if there isn't a fuel leak */
  1656. X#define SYS_NOSEGEAR    0x1000
  1657. X#define SYS_LEFTMAIN    0x2000
  1658. X#define SYS_RIGHTMAIN    0x4000
  1659. X#define SYS_NODAMAGE    0x7fff
  1660. X
  1661. X#define FLAG_LOWFUEL    0x8000    /* set when fuel < 1000 lbs */
  1662. X#define FLAG_SPEEDBRAKE    0x10000    /* set when speedbrake is deployed */
  1663. X#define FLAG_WHEELBRAKE    0x20000    /* set when wheel brakes are applied */
  1664. X
  1665. END_OF_FILE
  1666. if test 960 -ne `wc -c <'acm/fsim/damage.h'`; then
  1667.     echo shar: \"'acm/fsim/damage.h'\" unpacked with wrong size!
  1668. fi
  1669. # end of 'acm/fsim/damage.h'
  1670. fi
  1671. if test -f 'acm/fsim/droneCalc.c' -a "${1}" != "-c" ; then 
  1672.   echo shar: Will not clobber existing file \"'acm/fsim/droneCalc.c'\"
  1673. else
  1674. echo shar: Extracting \"'acm/fsim/droneCalc.c'\" \(676 characters\)
  1675. sed "s/^X//" >'acm/fsim/droneCalc.c' <<'END_OF_FILE'
  1676. X/*
  1677. X *    xflight : an aerial combat simulator for X
  1678. X *
  1679. X *    Written by Riley Rainey,  riley@mips.com
  1680. X *
  1681. X *    Permission to use, copy, modify and distribute (without charge) this
  1682. X *    software, documentation, images, etc. is granted, provided that this 
  1683. X *    comment and the author's name is retained.
  1684. X *
  1685. X */
  1686. X
  1687. X#include "pm.h"
  1688. X
  1689. X/*
  1690. X *  Drone flight management
  1691. X */
  1692. X
  1693. Xint droneCalculations (c)
  1694. Xcraft *c; {
  1695. X
  1696. X    c->prevSg = c->Sg;
  1697. X
  1698. X    c->Sg.x += c->Cg.x * deltaT;
  1699. X    c->Sg.y += c->Cg.y * deltaT;
  1700. X    c->Sg.z += c->Cg.z * deltaT;
  1701. X
  1702. X/*
  1703. X *  Don't let drones get above 60 thousand feet
  1704. X */
  1705. X
  1706. X    if (c->Sg.z < -60000.0)
  1707. X        return 1;
  1708. X
  1709. X/*
  1710. X *  Drone crash detection
  1711. X */
  1712. X
  1713. X    if (c->Sg.z > 0.0)
  1714. X        return 1;
  1715. X
  1716. X    return 0;
  1717. X}
  1718. END_OF_FILE
  1719. if test 676 -ne `wc -c <'acm/fsim/droneCalc.c'`; then
  1720.     echo shar: \"'acm/fsim/droneCalc.c'\" unpacked with wrong size!
  1721. fi
  1722. # end of 'acm/fsim/droneCalc.c'
  1723. fi
  1724. if test -f 'acm/fsim/flaps0.xbm' -a "${1}" != "-c" ; then 
  1725.   echo shar: Will not clobber existing file \"'acm/fsim/flaps0.xbm'\"
  1726. else
  1727. echo shar: Extracting \"'acm/fsim/flaps0.xbm'\" \(1729 characters\)
  1728. sed "s/^X//" >'acm/fsim/flaps0.xbm' <<'END_OF_FILE'
  1729. X#define flaps0_width 64
  1730. X#define flaps0_height 32
  1731. X#define flaps0_x_hot 4
  1732. X#define flaps0_y_hot 25
  1733. Xstatic char flaps0_bits[] = {
  1734. X   0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0xdf, 0xdd, 0xfd,
  1735. X   0x1f, 0x00, 0x00, 0x00, 0x60, 0xef, 0xee, 0xee, 0xee, 0x1f, 0x00, 0x00,
  1736. X   0x70, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x03, 0x00, 0x50, 0xbb, 0xbb, 0xbb,
  1737. X   0xbb, 0x7b, 0x7f, 0x00, 0x50, 0xdf, 0xdd, 0xdd, 0xdd, 0xbd, 0xff, 0x07,
  1738. X   0xe0, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00,
  1739. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1740. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1741. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1742. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1743. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1744. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1745. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1746. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1747. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1748. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1749. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1750. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1751. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1752. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1753. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1754. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1755. X   0x00, 0x00, 0x00, 0x00};
  1756. END_OF_FILE
  1757. if test 1729 -ne `wc -c <'acm/fsim/flaps0.xbm'`; then
  1758.     echo shar: \"'acm/fsim/flaps0.xbm'\" unpacked with wrong size!
  1759. fi
  1760. # end of 'acm/fsim/flaps0.xbm'
  1761. fi
  1762. if test -f 'acm/fsim/flaps2.xbm' -a "${1}" != "-c" ; then 
  1763.   echo shar: Will not clobber existing file \"'acm/fsim/flaps2.xbm'\"
  1764. else
  1765. echo shar: Extracting \"'acm/fsim/flaps2.xbm'\" \(1730 characters\)
  1766. sed "s/^X//" >'acm/fsim/flaps2.xbm' <<'END_OF_FILE'
  1767. X#define flaps2_width 64
  1768. X#define flaps2_height 32
  1769. X#define flaps2_x_hot -1
  1770. X#define flaps2_y_hot -1
  1771. Xstatic char flaps2_bits[] = {
  1772. X   0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xdd, 0xfd,
  1773. X   0x1f, 0x00, 0x00, 0x00, 0x20, 0xef, 0xee, 0xee, 0xee, 0xff, 0x03, 0x00,
  1774. X   0x30, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x3f, 0x00, 0x38, 0xbb, 0xbb, 0xbb,
  1775. X   0xbb, 0x7b, 0x00, 0x00, 0x28, 0xdf, 0xdd, 0xdd, 0xdd, 0x3d, 0x0e, 0x00,
  1776. X   0x6c, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1e, 0x00, 0x3c, 0x00, 0x00, 0x00,
  1777. X   0x00, 0x00, 0x3c, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
  1778. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00,
  1779. X   0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
  1780. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
  1781. X   0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1782. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1783. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1784. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1785. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1786. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1787. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1788. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1789. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1790. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1791. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1792. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1793. X   0x00, 0x00, 0x00, 0x00};
  1794. END_OF_FILE
  1795. if test 1730 -ne `wc -c <'acm/fsim/flaps2.xbm'`; then
  1796.     echo shar: \"'acm/fsim/flaps2.xbm'\" unpacked with wrong size!
  1797. fi
  1798. # end of 'acm/fsim/flaps2.xbm'
  1799. fi
  1800. if test -f 'acm/fsim/flaps3.xbm' -a "${1}" != "-c" ; then 
  1801.   echo shar: Will not clobber existing file \"'acm/fsim/flaps3.xbm'\"
  1802. else
  1803. echo shar: Extracting \"'acm/fsim/flaps3.xbm'\" \(1730 characters\)
  1804. sed "s/^X//" >'acm/fsim/flaps3.xbm' <<'END_OF_FILE'
  1805. X#define flaps3_width 64
  1806. X#define flaps3_height 32
  1807. X#define flaps3_x_hot -1
  1808. X#define flaps3_y_hot -1
  1809. Xstatic char flaps3_bits[] = {
  1810. X   0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xdd, 0xfd,
  1811. X   0x1f, 0x00, 0x00, 0x00, 0x20, 0xef, 0xee, 0xee, 0xee, 0xff, 0x03, 0x00,
  1812. X   0x30, 0x77, 0x77, 0x77, 0x77, 0xf7, 0x3f, 0x00, 0x38, 0xbb, 0xbb, 0xbb,
  1813. X   0xbb, 0x7b, 0x00, 0x00, 0x28, 0xdf, 0xdd, 0xdd, 0xdd, 0x3d, 0x0c, 0x00,
  1814. X   0x6c, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x3c, 0x00, 0x3c, 0x00, 0x00, 0x00,
  1815. X   0x00, 0x00, 0x38, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
  1816. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
  1817. X   0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01,
  1818. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
  1819. X   0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
  1820. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
  1821. X   0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1822. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1823. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1824. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1825. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1826. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1827. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1828. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1829. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1830. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1831. X   0x00, 0x00, 0x00, 0x00};
  1832. END_OF_FILE
  1833. if test 1730 -ne `wc -c <'acm/fsim/flaps3.xbm'`; then
  1834.     echo shar: \"'acm/fsim/flaps3.xbm'\" unpacked with wrong size!
  1835. fi
  1836. # end of 'acm/fsim/flaps3.xbm'
  1837. fi
  1838. if test -f 'acm/fsim/getStick.c' -a "${1}" != "-c" ; then 
  1839.   echo shar: Will not clobber existing file \"'acm/fsim/getStick.c'\"
  1840. else
  1841. echo shar: Extracting \"'acm/fsim/getStick.c'\" \(1272 characters\)
  1842. sed "s/^X//" >'acm/fsim/getStick.c' <<'END_OF_FILE'
  1843. X/*
  1844. X *    xflight : an aerial combat simulator for X
  1845. X *
  1846. X *    Written by Riley Rainey,  riley@mips.com
  1847. X *
  1848. X *    Permission to use, copy, modify and distribute (without charge) this
  1849. X *    software, documentation, images, etc. is granted, provided that this 
  1850. X *    comment and the author's name is retained.
  1851. X *
  1852. X */
  1853. X#include "pm.h"
  1854. X#include <math.h>
  1855. X
  1856. X/*
  1857. X *  getStick :  get stick input from mouse
  1858. X *        inputs Sa and Se range from -1.0 to 1.0.
  1859. X */
  1860. X
  1861. Xint getStick (c, u)
  1862. Xcraft *c;
  1863. Xviewer *u; {
  1864. X
  1865. X    int    rootX, rootY, x, y;
  1866. X    Window    root, child;
  1867. X    unsigned int mask;
  1868. X    double    d, fuzz;
  1869. X
  1870. X    if (XQueryPointer (u->dpy, u->win, &root, &child, &rootX, &rootY,
  1871. X        &x, &y, &mask) == True) {
  1872. X
  1873. X        if (x >= 0 && y >= 0 && x < u->width && y < u->height) {
  1874. X
  1875. X            fuzz = u->scaleFactor * 20.0;
  1876. X            x = x - u->xCenter;
  1877. X            y = y - u->yCenter;
  1878. X            d = sqrt ((double)(x*x + y*y));
  1879. X
  1880. X            if (d > fuzz) {
  1881. X                c->Sa=(double) x / (double) u->xCenter * (d-fuzz) / d;
  1882. X                c->Se=(double) y / (double) u->yCenter * (d-fuzz) / d;
  1883. X#ifndef LINEAR_CONTROL_RESPONSE
  1884. X                if (c->Sa < 0.0)
  1885. X                    c->Sa =  - c->Sa * c->Sa;
  1886. X                else
  1887. X                    c->Sa = c->Sa * c->Sa;
  1888. X
  1889. X                if (c->Se < 0.0)
  1890. X                    c->Se = - c->Se * c->Se;
  1891. X                else
  1892. X                    c->Se = c->Se * c->Se;
  1893. X#endif
  1894. X            }
  1895. X            else {
  1896. X                c->Sa = 0.0;
  1897. X                c->Se = 0.0;
  1898. X            }
  1899. X            return 1;
  1900. X
  1901. X        }
  1902. X    }
  1903. X
  1904. X    return 0;
  1905. X}
  1906. END_OF_FILE
  1907. if test 1272 -ne `wc -c <'acm/fsim/getStick.c'`; then
  1908.     echo shar: \"'acm/fsim/getStick.c'\" unpacked with wrong size!
  1909. fi
  1910. # end of 'acm/fsim/getStick.c'
  1911. fi
  1912. if test -f 'acm/fsim/header' -a "${1}" != "-c" ; then 
  1913.   echo shar: Will not clobber existing file \"'acm/fsim/header'\"
  1914. else
  1915. echo shar: Extracting \"'acm/fsim/header'\" \(297 characters\)
  1916. sed "s/^X//" >'acm/fsim/header' <<'END_OF_FILE'
  1917. X/*
  1918. X *    xflight : an aerial combat simulator for X
  1919. X *
  1920. X *    Written by Riley Rainey,  riley@mips.com
  1921. X *
  1922. X *    Permission to use, copy, modify and distribute (without charge) this
  1923. X *    software, documentation, images, etc. is granted, provided that this 
  1924. X *    comment and the author's name is retained.
  1925. X *
  1926. X */
  1927. END_OF_FILE
  1928. if test 297 -ne `wc -c <'acm/fsim/header'`; then
  1929.     echo shar: \"'acm/fsim/header'\" unpacked with wrong size!
  1930. fi
  1931. # end of 'acm/fsim/header'
  1932. fi
  1933. if test -f 'acm/fsim/manifest.h' -a "${1}" != "-c" ; then 
  1934.   echo shar: Will not clobber existing file \"'acm/fsim/manifest.h'\"
  1935. else
  1936. echo shar: Extracting \"'acm/fsim/manifest.h'\" \(1193 characters\)
  1937. sed "s/^X//" >'acm/fsim/manifest.h' <<'END_OF_FILE'
  1938. X/*
  1939. X *  UPDATE_INTERVAL define the number of microseconds between
  1940. X *  each position update when the game is running.
  1941. X */
  1942. X#define UPDATE_INTERVAL        125000
  1943. X
  1944. X/*
  1945. X *  REDRAW_EVERY defines the number of update intervals between each
  1946. X *  redraw of player screens.
  1947. X */
  1948. X
  1949. X#define REDRAW_EVERY        3
  1950. X
  1951. X/*
  1952. X *  ACM_PORT define the internet port number to be used in the game 
  1953. X *  startup handshaking.
  1954. X */
  1955. X
  1956. X#define ACM_PORT        3232
  1957. X
  1958. X/*
  1959. X *  ACM becomes the name used to lookup X resources on a particular
  1960. X *  X server.
  1961. X */
  1962. X
  1963. X#define ACM            "acm"
  1964. X
  1965. X/*
  1966. X *  Animation on multi-plane displays can be performed with pixmaps or by
  1967. X *  manipulating planes and colors.  If USE_PIXMAP_ANIMATION is defined, we'll
  1968. X *  use that method.
  1969. X *
  1970. X *  *** Warning:  this does not work, yet ***
  1971. X */
  1972. X
  1973. X/* #define USE_PIXMAP_ANIMATION */
  1974. X
  1975. X/*
  1976. X *  Linear response to control stick inputs can make the plane harder
  1977. X *  to fly.
  1978. X */
  1979. X
  1980. X/* #define LINEAR_CONTROL_RESPONSE */
  1981. X
  1982. X/*
  1983. X *  Define a library directory to contain the acm files
  1984. X */
  1985. X
  1986. X#define ACM_LIBRARY        "/usr/games/lib/acm/"
  1987. X
  1988. X/*
  1989. X *  a signal handler function type
  1990. X */
  1991. X
  1992. X#ifdef SIGVOID
  1993. X#define acm_sig_t    void    /* System V returns void */
  1994. X#else
  1995. X#define acm_sig_t    int    /* BSD does int's */
  1996. X#endif
  1997. END_OF_FILE
  1998. if test 1193 -ne `wc -c <'acm/fsim/manifest.h'`; then
  1999.     echo shar: \"'acm/fsim/manifest.h'\" unpacked with wrong size!
  2000. fi
  2001. # end of 'acm/fsim/manifest.h'
  2002. fi
  2003. if test -f 'acm/fsim/mtn' -a "${1}" != "-c" ; then 
  2004.   echo shar: Will not clobber existing file \"'acm/fsim/mtn'\"
  2005. else
  2006. echo shar: Extracting \"'acm/fsim/mtn'\" \(140 characters\)
  2007. sed "s/^X//" >'acm/fsim/mtn' <<'END_OF_FILE'
  2008. X*mountain
  2009. X5 4
  2010. X1 28000 0 0
  2011. X2 0 16000 0
  2012. X3 -35000 0 0
  2013. X4 0 -14000 0
  2014. X5 0 0 -8200
  2015. X#788b63 3 1 2 5
  2016. X#788b63 3 2 3 5
  2017. X#788b63 3 3 4 5
  2018. X#788b63 3 4 1 5
  2019. END_OF_FILE
  2020. if test 140 -ne `wc -c <'acm/fsim/mtn'`; then
  2021.     echo shar: \"'acm/fsim/mtn'\" unpacked with wrong size!
  2022. fi
  2023. # end of 'acm/fsim/mtn'
  2024. fi
  2025. if test -f 'acm/fsim/patchlevel.h' -a "${1}" != "-c" ; then 
  2026.   echo shar: Will not clobber existing file \"'acm/fsim/patchlevel.h'\"
  2027. else
  2028. echo shar: Extracting \"'acm/fsim/patchlevel.h'\" \(85 characters\)
  2029. sed "s/^X//" >'acm/fsim/patchlevel.h' <<'END_OF_FILE'
  2030. X/*
  2031. X *  Revision information for acm 2.1
  2032. X */
  2033. X
  2034. X#define REVISION    2
  2035. X#define PATCHLEVEL    1
  2036. END_OF_FILE
  2037. if test 85 -ne `wc -c <'acm/fsim/patchlevel.h'`; then
  2038.     echo shar: \"'acm/fsim/patchlevel.h'\" unpacked with wrong size!
  2039. fi
  2040. # end of 'acm/fsim/patchlevel.h'
  2041. fi
  2042. if test -f 'acm/fsim/placeCraft.c' -a "${1}" != "-c" ; then 
  2043.   echo shar: Will not clobber existing file \"'acm/fsim/placeCraft.c'\"
  2044. else
  2045. echo shar: Extracting \"'acm/fsim/placeCraft.c'\" \(1112 characters\)
  2046. sed "s/^X//" >'acm/fsim/placeCraft.c' <<'END_OF_FILE'
  2047. X/*
  2048. X *    xflight : an aerial combat simulator for X
  2049. X *
  2050. X *    Written by Riley Rainey,  riley@mips.com
  2051. X *
  2052. X *    Permission to use, copy, modify and distribute (without charge) this
  2053. X *    software, documentation, images, etc. is granted, provided that this 
  2054. X *    comment and the author's name is retained.
  2055. X *
  2056. X */
  2057. X#include "pm.h"
  2058. X
  2059. Xvoid placeCraft (obj, poly, cnt)
  2060. Xcraft     *obj;
  2061. XVPolygon **poly;
  2062. Xint     *cnt; {
  2063. X
  2064. X    int     i, j, k, n;
  2065. X    VPoint     *q, tmp;
  2066. X    VMatrix     mtx;
  2067. X    VPolygon **p;
  2068. X
  2069. X    j = *cnt;
  2070. X
  2071. X    VIdentMatrix (&mtx);
  2072. X    if (obj->curRoll != 0.0)
  2073. X        VRotate (&mtx, XRotation, obj->curRoll);
  2074. X    if (obj->curPitch != 0.0)
  2075. X        VRotate (&mtx, YRotation, - obj->curPitch);
  2076. X    if (obj->curHeading != 0.0)
  2077. X        VRotate (&mtx, ZRotation, obj->curHeading);
  2078. X    VTranslatePoint (&mtx, obj->Sg);
  2079. X
  2080. X    if (obj->cinfo->placeProc != NULL) {
  2081. X        (*obj->cinfo->placeProc)(obj, &mtx, poly, cnt);
  2082. X        return;
  2083. X    }
  2084. X
  2085. X    n = obj->cinfo->object->numPolys;
  2086. X    p = obj->cinfo->object->polygon;
  2087. X    for (i=0; i<n; ++i) {
  2088. X
  2089. X        poly[j] = VCopyPolygon(p[i]);
  2090. X        for ((k=0, q=poly[j]->vertex); k<poly[j]->numVtces; (++k, ++q)) {
  2091. X            VTransform(q, &mtx, &tmp);
  2092. X            *q = tmp;
  2093. X        }
  2094. X        ++j;
  2095. X    }
  2096. X
  2097. X    *cnt = j;
  2098. X}
  2099. END_OF_FILE
  2100. if test 1112 -ne `wc -c <'acm/fsim/placeCraft.c'`; then
  2101.     echo shar: \"'acm/fsim/placeCraft.c'\" unpacked with wrong size!
  2102. fi
  2103. # end of 'acm/fsim/placeCraft.c'
  2104. fi
  2105. if test -f 'acm/fsim/rwy2' -a "${1}" != "-c" ; then 
  2106.   echo shar: Will not clobber existing file \"'acm/fsim/rwy2'\"
  2107. else
  2108. echo shar: Extracting \"'acm/fsim/rwy2'\" \(97 characters\)
  2109. sed "s/^X//" >'acm/fsim/rwy2' <<'END_OF_FILE'
  2110. XRunway
  2111. X4 1
  2112. X1 0 -75.000000 0
  2113. X2 12000 -75 0
  2114. X3 12000 75.000000 0
  2115. X4 0 75.000000 0
  2116. X#b7b19f 4  1 2 3 4
  2117. END_OF_FILE
  2118. if test 97 -ne `wc -c <'acm/fsim/rwy2'`; then
  2119.     echo shar: \"'acm/fsim/rwy2'\" unpacked with wrong size!
  2120. fi
  2121. # end of 'acm/fsim/rwy2'
  2122. fi
  2123. if test -f 'acm/fsim/scale.h' -a "${1}" != "-c" ; then 
  2124.   echo shar: Will not clobber existing file \"'acm/fsim/scale.h'\"
  2125. else
  2126. echo shar: Extracting \"'acm/fsim/scale.h'\" \(621 characters\)
  2127. sed "s/^X//" >'acm/fsim/scale.h' <<'END_OF_FILE'
  2128. Xtypedef struct {
  2129. X    int    xorg;        /* x loc of bottom of scale */
  2130. X    int    yorg;        /* y loc of bottom of scale */
  2131. X    int    length;        /* length of scale (pixels) */
  2132. X    int    orientation;    /* orientation flags */
  2133. X    double    scale;        /* units per pixel */
  2134. X    int    minorInterval;    /* units per minor tick */
  2135. X    int    minorSize;    /* width of minor ticks (pixels) */
  2136. X    int    majorInterval;    /* units per major tick */
  2137. X    int    majorSize;    /* width of major ticks (pixels) */
  2138. X    int    indexSize;    /* width of index (pixels) */
  2139. X    double    divisor;    /* divisor on digit scale */
  2140. X    char    *format;    /* output format */
  2141. X    }    scaleControl;
  2142. X
  2143. X#define orientRight        1
  2144. X#define orientHorizontal    2
  2145. END_OF_FILE
  2146. if test 621 -ne `wc -c <'acm/fsim/scale.h'`; then
  2147.     echo shar: \"'acm/fsim/scale.h'\" unpacked with wrong size!
  2148. fi
  2149. # end of 'acm/fsim/scale.h'
  2150. fi
  2151. if test -f 'acm/fsim/tower' -a "${1}" != "-c" ; then 
  2152.   echo shar: Will not clobber existing file \"'acm/fsim/tower'\"
  2153. else
  2154. echo shar: Extracting \"'acm/fsim/tower'\" \(1158 characters\)
  2155. sed "s/^X//" >'acm/fsim/tower' <<'END_OF_FILE'
  2156. X*-a-control-tower
  2157. X60 16
  2158. X1 20 20 0
  2159. X2 20 -20 0
  2160. X3 12 -12 -60
  2161. X4 12 12 -60
  2162. X5 12 12 -60
  2163. X6 12 -12 -60
  2164. X7 12 -12 -64
  2165. X8 12 12 -64
  2166. X9 12 0.25 -64
  2167. X10 12 -0.25 -64
  2168. X11 12 -0.25 -72
  2169. X12 12 0.25 -72
  2170. X13 14 14 -72
  2171. X14 14 -14 -72
  2172. X15 0 0 -76
  2173. X16 -20 -20 0
  2174. X17 -20 20 0
  2175. X18 -12 12 -60
  2176. X19 -12 -12 -60
  2177. X20 -12 -12 -60
  2178. X21 -12 12 -60
  2179. X22 -12 12 -64
  2180. X23 -12 -12 -64
  2181. X24 -12 -0.25 -64
  2182. X25 -12 0.25 -64
  2183. X26 -12 0.25 -72
  2184. X27 -12 -0.25 -72
  2185. X28 -14 -14 -72
  2186. X29 -14 14 -72
  2187. X30 0 0 -76
  2188. X31 20 20 0
  2189. X32 -20 20 0
  2190. X33 -12 12 -60
  2191. X34 12 12 -60
  2192. X35 12 12 -60
  2193. X36 -12 12 -60
  2194. X37 -12 12 -64
  2195. X38 12 12 -64
  2196. X39 12 0.25 -64
  2197. X40 -12 0.25 -64
  2198. X41 -12 0.25 -72
  2199. X42 12 0.25 -72
  2200. X43 14 14 -72
  2201. X44 -14 14 -72
  2202. X45 0 0 -76
  2203. X46 -20 -20 0
  2204. X47 20 -20 0
  2205. X48 12 -12 -60
  2206. X49 -12 -12 -60
  2207. X50 -12 -12 -60
  2208. X51 12 -12 -60
  2209. X52 12 -12 -64
  2210. X53 -12 -12 -64
  2211. X54 -12 -0.25 -64
  2212. X55 12 -0.25 -64
  2213. X56 12 -0.25 -72
  2214. X57 -12 -0.25 -72
  2215. X58 -14 -14 -72
  2216. X59 14 -14 -72
  2217. X60 0 0 -76
  2218. Xblack 4 1 2 3 4
  2219. Xblack 4 5 6 7 8
  2220. Xblack 4 9 10 11 12
  2221. Xblack 3 13 14 15
  2222. Xblack 4 16 17 18 19
  2223. Xblack 4 20 21 22 23
  2224. Xblack 4 24 25 26 27
  2225. Xblack 3 28 29 30
  2226. Xblack 4 31 32 33 34
  2227. Xblack 4 35 36 37 38
  2228. Xblack 4 39 40 41 42
  2229. Xblack 3 43 44 45
  2230. Xblack 4 46 47 48 49
  2231. Xblack 4 50 51 52 53
  2232. Xblack 4 54 55 56 57
  2233. Xblack 3 58 59 60
  2234. END_OF_FILE
  2235. if test 1158 -ne `wc -c <'acm/fsim/tower'`; then
  2236.     echo shar: \"'acm/fsim/tower'\" unpacked with wrong size!
  2237. fi
  2238. # end of 'acm/fsim/tower'
  2239. fi
  2240. if test -f 'acm/fsim/transpose.c' -a "${1}" != "-c" ; then 
  2241.   echo shar: Will not clobber existing file \"'acm/fsim/transpose.c'\"
  2242. else
  2243. echo shar: Extracting \"'acm/fsim/transpose.c'\" \(454 characters\)
  2244. sed "s/^X//" >'acm/fsim/transpose.c' <<'END_OF_FILE'
  2245. X/*
  2246. X *    xflight : an aerial combat simulator for X
  2247. X *
  2248. X *    Written by Riley Rainey,  riley@mips.com
  2249. X *
  2250. X *    Permission to use, copy, modify and distribute (without charge) this
  2251. X *    software, documentation, images, etc. is granted, provided that this 
  2252. X *    comment and the author's name is retained.
  2253. X *
  2254. X */
  2255. X#include <Vlib.h>
  2256. X
  2257. Xint    transpose (m, r)
  2258. XVMatrix *m, *r; {
  2259. X
  2260. X    int    i, j;
  2261. X
  2262. X    for (i=0; i<4; ++i)
  2263. X        for (j=0; j<4; ++j)
  2264. X            r->m[i][j] = m->m[j][i];
  2265. X    return 0;
  2266. X}
  2267. END_OF_FILE
  2268. if test 454 -ne `wc -c <'acm/fsim/transpose.c'`; then
  2269.     echo shar: \"'acm/fsim/transpose.c'\" unpacked with wrong size!
  2270. fi
  2271. # end of 'acm/fsim/transpose.c'
  2272. fi
  2273. if test -f 'acm/fsim/update.c' -a "${1}" != "-c" ; then 
  2274.   echo shar: Will not clobber existing file \"'acm/fsim/update.c'\"
  2275. else
  2276. echo shar: Extracting \"'acm/fsim/update.c'\" \(1141 characters\)
  2277. sed "s/^X//" >'acm/fsim/update.c' <<'END_OF_FILE'
  2278. X/*
  2279. X *    xflight : an aerial combat simulator for X
  2280. X *
  2281. X *    Written by Riley Rainey,  riley@mips.com
  2282. X *
  2283. X *    Permission to use, copy, modify and distribute (without charge) this
  2284. X *    software, documentation, images, etc. is granted, provided that this 
  2285. X *    comment and the author's name is retained.
  2286. X *
  2287. X */
  2288. X#include "pm.h"
  2289. X#include <X11/Xutil.h>
  2290. X
  2291. Xextern int flightCalculations();
  2292. Xextern int missileCalculations();
  2293. Xextern void doEvents(), doViews(), flapControl();
  2294. X
  2295. Xint cur = 0;
  2296. X
  2297. Xint redraw () {
  2298. X
  2299. X    int    i;
  2300. X    craft    *p;
  2301. X    
  2302. X    for ((i=0, p=ptbl); i<MAXPLAYERS; (++i, ++p)) {
  2303. X        if (p->type == CT_PLANE) {
  2304. X            doEvents (p);
  2305. X            if (flightCalculations (p) == 1)
  2306. X                killPlayer (p);
  2307. X            doWeaponUpdate (p);
  2308. X            flapControl (p);
  2309. X        }
  2310. X        else if (p->type == CT_DRONE)
  2311. X            if (droneCalculations (p) == 1)
  2312. X                killPlayer (p);
  2313. X    }
  2314. X
  2315. X    for ((i=0, p=mtbl); i<MAXPROJECTILES; (++i, ++p)) {
  2316. X        if (p->type == CT_MISSILE) {
  2317. X            if (missileCalculations (p) == 1)
  2318. X                killMissile (p);
  2319. X        }
  2320. X        else if (p->type == CT_CANNON)
  2321. X            if (cannonCalculations (p) == 1)
  2322. X                killMissile (p);
  2323. X    }
  2324. X
  2325. X    lookForImpacts ();
  2326. X
  2327. X    if (cur++ % REDRAW_EVERY == 0)
  2328. X        doViews ();
  2329. X
  2330. X    curTime += deltaT;
  2331. X
  2332. X    return 0;
  2333. X
  2334. X}
  2335. END_OF_FILE
  2336. if test 1141 -ne `wc -c <'acm/fsim/update.c'`; then
  2337.     echo shar: \"'acm/fsim/update.c'\" unpacked with wrong size!
  2338. fi
  2339. # end of 'acm/fsim/update.c'
  2340. fi
  2341. if test -f 'acm/fsim/weapon.c' -a "${1}" != "-c" ; then 
  2342.   echo shar: Will not clobber existing file \"'acm/fsim/weapon.c'\"
  2343. else
  2344. echo shar: Extracting \"'acm/fsim/weapon.c'\" \(1276 characters\)
  2345. sed "s/^X//" >'acm/fsim/weapon.c' <<'END_OF_FILE'
  2346. X/*
  2347. X *    xflight : an aerial combat simulator for X
  2348. X *
  2349. X *    Written by Riley Rainey,  riley@mips.com
  2350. X *
  2351. X *    Permission to use, copy, modify and distribute (without charge) this
  2352. X *    software, documentation, images, etc. is granted, provided that this 
  2353. X *    comment and the author's name is retained.
  2354. X *
  2355. X */
  2356. X
  2357. X#include <string.h>
  2358. X#include "pm.h"
  2359. X
  2360. Xint selectWeapon(c)
  2361. Xcraft *c; {
  2362. X
  2363. X    register int n, m;
  2364. X
  2365. X    m = c->curWeapon;
  2366. X    n = (c->curWeapon + 1) % WEAPONTYPES;
  2367. X    for (; n != m; n = (n + 1) % WEAPONTYPES) {
  2368. X        if (wtbl[n].select != NULL)
  2369. X            if ((*wtbl[n].select)(c) == 1) {
  2370. X                c->curWeapon = n;
  2371. X                return 1;
  2372. X            }
  2373. X    }
  2374. X
  2375. X    return 0;
  2376. X}
  2377. X
  2378. Xint fireWeapon (c)
  2379. Xcraft *c; {
  2380. X
  2381. X    if (wtbl[c->curWeapon].firePress != NULL)
  2382. X        return (*wtbl[c->curWeapon].firePress)(c);
  2383. X
  2384. X    return 0;
  2385. X}
  2386. X
  2387. Xint ceaseFireWeapon (c)
  2388. Xcraft *c; {
  2389. X
  2390. X    if (wtbl[c->curWeapon].fireRelease != NULL)
  2391. X        return (*wtbl[c->curWeapon].fireRelease)(c);
  2392. X
  2393. X    return 0;
  2394. X}
  2395. X
  2396. Xint doWeaponDisplay (c, u)
  2397. Xcraft *c;
  2398. Xviewer *u; {
  2399. X
  2400. X    int    i;
  2401. X
  2402. X    if (wtbl[c->curWeapon].display != NULL)
  2403. X        return (*wtbl[c->curWeapon].display)(c, wtbl[c->curWeapon].w, u);
  2404. X    else {
  2405. X        for (i=0; i<3; i++)
  2406. X            strcpy (c->leftHUD[i], "");
  2407. X    }
  2408. X
  2409. X    return 0;
  2410. X}
  2411. X
  2412. Xint doWeaponUpdate (c)
  2413. Xcraft *c; {
  2414. X
  2415. X    if (wtbl[c->curWeapon].update != NULL)
  2416. X        return (*wtbl[c->curWeapon].update)(c);
  2417. X
  2418. X    return 0;
  2419. X}
  2420. END_OF_FILE
  2421. if test 1276 -ne `wc -c <'acm/fsim/weapon.c'`; then
  2422.     echo shar: \"'acm/fsim/weapon.c'\" unpacked with wrong size!
  2423. fi
  2424. # end of 'acm/fsim/weapon.c'
  2425. fi
  2426. if test -f 'acm/install-objects' -a "${1}" != "-c" ; then 
  2427.   echo shar: Will not clobber existing file \"'acm/install-objects'\"
  2428. else
  2429. echo shar: Extracting \"'acm/install-objects'\" \(268 characters\)
  2430. sed "s/^X//" >'acm/install-objects' <<'END_OF_FILE'
  2431. X#! /bin/sh
  2432. X#
  2433. X#  This script installs acm object description files.
  2434. X#  To change this location, you must also change the ACM_LIBRARY definition
  2435. X#  in fsim/manifest.h.
  2436. XBINDIR=/usr/games/lib/acm
  2437. X
  2438. Xcd fsim
  2439. Xmkdir $BINDIR
  2440. Xcp f16 mig23 aim-9 bullet mtn rwy rwy2 tower $BINDIR
  2441. END_OF_FILE
  2442. if test 268 -ne `wc -c <'acm/install-objects'`; then
  2443.     echo shar: \"'acm/install-objects'\" unpacked with wrong size!
  2444. fi
  2445. chmod +x 'acm/install-objects'
  2446. # end of 'acm/install-objects'
  2447. fi
  2448. echo shar: End of archive 1 \(of 9\).
  2449. cp /dev/null ark1isdone
  2450. MISSING=""
  2451. for I in 1 2 3 4 5 6 7 8 9 ; do
  2452.     if test ! -f ark${I}isdone ; then
  2453.     MISSING="${MISSING} ${I}"
  2454.     fi
  2455. done
  2456. if test "${MISSING}" = "" ; then
  2457.     echo You have unpacked all 9 archives.
  2458.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2459. else
  2460.     echo You still need to unpack the following archives:
  2461.     echo "        " ${MISSING}
  2462. fi
  2463. ##  End of shell archive.
  2464. exit 0
  2465. -- 
  2466. Riley Rainey            Internet: riley@mips.com
  2467. MIPS Computer Systems        Phone:    +1 214 770-7979
  2468. Dallas, Texas
  2469.